Skip to content

Fix scrcpy streams rendering on Safari using MessageChannel fallback#137

Merged
RoiArthurB merged 1 commit intodevfrom
fix-scrcpy-stream-safari-4258149670714501933
Mar 31, 2026
Merged

Fix scrcpy streams rendering on Safari using MessageChannel fallback#137
RoiArthurB merged 1 commit intodevfrom
fix-scrcpy-stream-safari-4258149670714501933

Conversation

@RoiArthurB
Copy link
Copy Markdown
Contributor

Fixes an issue where scrcpy streams were not rendering correctly (transparent canvas) on Safari due to its inability to transfer ReadableStream objects to Web Workers.

Changes:

  • Added feature detection in VideoStreamManager.tsx to safely check if ReadableStream can be transferred.
  • Added a MessageChannel fallback for browsers that fail the feature detection (e.g., Safari).
  • Updated the scrcpyDecoder.ts web worker to reconstruct the ReadableStream from a MessagePort when using the fallback method.
  • Added graceful fallbacks and warning logs when the VideoDecoder API is missing.
  • Ensured that other browsers (Chrome, Firefox) that support stream transfer continue to use the optimal direct transfer method.

PR created automatically by Jules for task 4258149670714501933 started by @RoiArthurB

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>
@google-labs-jules
Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sonarqubecloud
Copy link
Copy Markdown

@RoiArthurB RoiArthurB merged commit ee5c0a7 into dev Mar 31, 2026
2 checks passed
@RoiArthurB RoiArthurB deleted the fix-scrcpy-stream-safari-4258149670714501933 branch March 31, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant