Skip to content

Muted videos do not autoplay in Safari #14087

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

Closed
zchlm opened this issue Oct 31, 2024 · 3 comments · Fixed by #14095
Closed

Muted videos do not autoplay in Safari #14087

zchlm opened this issue Oct 31, 2024 · 3 comments · Fixed by #14095
Assignees
Labels

Comments

@zchlm
Copy link

zchlm commented Oct 31, 2024

Describe the bug

I have encountered an issue where muted videos do not autoplay in Safari when using Svelte. This behavior differs from Chrome, where the videos autoplay correctly. In a vanilla JavaScript implementation, the autoplay works as expected.

Reproduction

  1. Open the Svelte reproduction link in Safari: Svelte Playground
  2. Observe that the muted video does not autoplay.
  3. Open the following CodePen in Safari: Vanilla CodePen
  4. Observe that the muted video autoplays correctly.

Logs

No response

System Info

System:
    OS: macOS 15.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 71.89 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.local/share/mise/installs/node/20/bin/node
    npm: 10.9.0 - ~/.local/share/mise/installs/node/20/bin/npm
    pnpm: 9.12.3 - ~/.local/share/mise/installs/node/20/bin/pnpm
    bun: 1.1.33 - ~/.bun/bin/bun
  Browsers:
    Safari: 18.1
  npmPackages:
    svelte: ^5.1.4 => 5.1.9

Severity

annoyance

@trueadm trueadm added the bug label Nov 1, 2024
@trueadm
Copy link
Contributor

trueadm commented Nov 1, 2024

This is yet another browser bug to do with element.cloneNode, using document.importNode seems to work though. :(

@Fd929c2CE5fA
Copy link

@trueadm Another way I've tried that works is video.play(), as suggested in the WebKit blog. Maybe worth reference.

Playground-5.1.9

@whalderman
Copy link

While not a complete solution to this problem, in cases where the video acts as an animated image (.gif, etc.), the Safari team prefers unintuitively using the img tag in place of the video tag to autoplay the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants