Skip to content

media-preview: try unmuted autoplay before falling back to muted - #340855

Open
ANIL KUMAR MEENA (anilkumarmeena) wants to merge 2 commits into
microsoft:mainfrom
anilkumarmeena:anilkumarmeena/video-preview-autoplay-sound-
Open

ANIL KUMAR MEENA (anilkumarmeena) wants to merge 2 commits into
microsoft:mainfrom
anilkumarmeena:anilkumarmeena/video-preview-autoplay-sound-

Conversation

@anilkumarmeena

Copy link
Copy Markdown

When mediaPreview.video.autoPlay is enabled, the video preview always mutes the video (video.muted = settings.autoplay), even in environments where autoplay with sound is allowed.

This change tries to autoplay with sound first and only falls back to muted playback if the browser rejects play() with NotAllowedError. The setting description is updated to match.

Changes

  • media/videoPreview.js: replace the autoplay/muted attributes with an explicit play() call once the video has loaded, falling back to muted playback when autoplay with sound is blocked.
  • package.nls.json: update the mediaPreview.video.autoPlay description.

Notes

  • Desktop windows use autoplayPolicy: 'user-gesture-required', and opening a file does not count as a gesture inside the newly created webview frame. So on desktop the preview still starts muted today, same as before. The change only matters where autoplay with sound is permitted, and it no longer forces mute unconditionally.
  • With autoPlay off, behavior is unchanged: the video is never muted and plays with sound when the user presses play.

How to test

  1. Enable "mediaPreview.video.autoPlay": true.
  2. Open an .mp4 that has an audio track.
  3. The video autoplays. If autoplay with sound is blocked, it plays muted and can be unmuted from the controls.
  4. With autoPlay disabled, press play and check that audio plays.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the documented behavior without affecting disabled-autoplay behavior.

0 open findings

What changed in this PR

Updates video previews to prefer autoplay with sound and fall back to muted playback when blocked.

Changes:

  • Uses explicit play() calls with a muted fallback.
  • Updates the autoplay setting description.
File Description
extensions/​media-preview/​media/​videoPreview.js Implements sound-first autoplay fallback.
extensions/​media-preview/​package.nls.json Clarifies autoplay behavior.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@anilkumarmeena

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants