-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dgw): fallback to recording playback when shadowing is not possible #1181
fix(dgw): fallback to recording playback when shadowing is not possible #1181
Conversation
Let maintainers know that an action is required on their side
|
Co-authored-by: Benoît Cortier <[email protected]>
webapp/player-project/src/main.ts
Outdated
showNotification('Session may have ended,playing recording instead', 'info'); | ||
return { | ||
...closeEvent, | ||
code: 1000, // for avoid extra handling by other listeners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I understand you are not used to it, but I would appreciate if you could follow this style more closely.
https://github.com/Devolutions/IronRDP/blob/master/STYLE.md#inline-code-comments-are-proper-sentences
The important thing with this suggestion is:
Rationale: writing a sentence (or maybe even a paragraph) rather just "a comment" creates a more appropriate frame of mind. It tricks you into writing down more of the context you keep in your head while coding.
At my level, I don’t really understand the connection between "1000" and "avoid extra handling by other listeners", suggesting the comment could give me more relevant context to understand what is happening. Of course, I could start digging up the code to try to understand why this is good or necessary, but it’s always nice when the comment can save more time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated , it is for asciinema-player, I added the link of the specific line that would cause problem in the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget to push your commit? I don’t see the change. Also, what do you mean by link? Since the codebase is evolving, a link to our GitHub repository may become outdated at anytime. Instead, describes using module name, function name, and other stable descriptions. It’s also okay to define anchors. For instance:
// ANCHOR: some_anchor_name
let foo = bar;
// Search for the some_anchor_name anchor to see where this is relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my muscle memory makes switched me to another terminal without looking at the push result properly. I push the proper comment, and it is a link to the asciinema-player github project at the line where code 1000 is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll adjust accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it’s a different GitHub project? Then forget what I said, the link is fine!
Do you have a Jira ticket for this task? If so, add the footer: |
No, this is not related to any existing Jira tickets |
…b.com:Devolutions/devolutions-gateway into proper-fall-back-when-streaming-not-available
webapp/player-project/src/main.ts
Outdated
// for avoid extra handling by other listeners, for asciinema-player particularly in this case. | ||
// see asciinema-player websocket driver at on socket close handler | ||
code: 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Here is an improved wording. Both a stable description and a permalink are provided since this is an external repository.
// for avoid extra handling by other listeners, for asciinema-player particularly in this case. | |
// see asciinema-player websocket driver at on socket close handler | |
code: 1000, | |
// This prevents extra handling by other listeners, particularly for asciinema-player in this scenario. | |
// For more details, see the asciinema-player WebSocket driver’s socket close handler. | |
// https://github.com/asciinema/asciinema-player/blob/c09e1d2625450a32e9e76063cdc315fd54ecdd9d/src/driver/websocket.js#L219 | |
code: 1000, |
webapp/player-project/src/main.ts
Outdated
@@ -23,6 +25,20 @@ async function playSessionShadowing(gatewayAccessApi) { | |||
try { | |||
const recordingInfo = await gatewayAccessApi.fetchRecordingInfo(); | |||
const fileType = getFileType(recordingInfo); | |||
BeforeWebsocketClose((closeEvent) => { | |||
if (closeEvent.code !== 1000) { | |||
// faild, try to play static recording |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: This comment is also not clearly worded out. Here is how you could improve that.
// faild, try to play static recording | |
// The session playback failed; attempt to play the recording as usual as a fallback. |
@@ -17,3 +17,12 @@ export const getShadowPlayer = (fileType) => { | |||
|
|||
return player; | |||
}; | |||
|
|||
export const cleanUpStreamers = () => { | |||
// Clean up any existing shadow-player elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: This comment is probably unnecessary, but if you want to keep it, here is a better wording.
// Clean up any existing shadow-player elements | |
// Remove all shadow-player elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that in this case, it’s much more useful to describe the why, rather than the what. Maybe it makes more sense to explain the why at the callsite of this function.
Here, the why could be something like "Removes the shadow player layout, so the regular recording player is visible again."
The reader of the code now understands the intention, and it’s easier to work from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m sorry for the pedantic comments, but it would really help me as a reviewer, and all future readers of the code, including yourself, if you could take some time to consider what I said carefully, and include the suggested practices in your coding style in your future contributions. I left and applied new comments, and I’ll leave you double check and merge the PR. If you struggle with English redaction, it’s fine to let an AI help you with that. ChatGPT or Copilot will do a great job at improving the text itself, but you need to write with intention. Thank you.
This happens when the session is already terminated.
Screen.Recording.2025-01-08.093650.mp4