Fix scrcpy streams rendering on Safari using MessageChannel fallback#137
Conversation
Safari does not support transferring ReadableStream objects directly to Web Workers via postMessage. This commit adds a feature detection check to see if transferring a ReadableStream is supported by the browser. If supported (like in Chrome and Firefox), it continues to transfer the stream directly for optimal performance. If unsupported (like in Safari), it falls back to using a MessageChannel to stream chunks manually to the worker, where the stream is reconstructed. Also adds checks for VideoDecoder availability to prevent errors in unsupported environments. Co-authored-by: RoiArthurB <16764085+RoiArthurB@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|



Fixes an issue where scrcpy streams were not rendering correctly (transparent canvas) on Safari due to its inability to transfer
ReadableStreamobjects to Web Workers.Changes:
VideoStreamManager.tsxto safely check ifReadableStreamcan be transferred.MessageChannelfallback for browsers that fail the feature detection (e.g., Safari).scrcpyDecoder.tsweb worker to reconstruct theReadableStreamfrom aMessagePortwhen using the fallback method.VideoDecoderAPI is missing.PR created automatically by Jules for task 4258149670714501933 started by @RoiArthurB