Muted flag is broken until you manually mute or unmute


#1

Observed Behavior

The stream embed url’s muted flag does nothing until you’ve muted or unmuted any stream using the player’s controls.

Expected Behavior

The muted flag should work without having to manually mute or unmute first.

Repro Steps

  1. Open Chrome Incognito or Firefox Private

  2. Navigate to https://twitch.tv

  3. Mute any live stream

  4. Open a new tab

  5. Navigate to any live stream embed url with the flag &muted=false (e.g. https://player.twitch.tv/?channel=gamesdonequick&controls=false&muted=false). The channel will be muted and the flag does nothing.

  6. Go back to the first tab and unmute the channel

  7. On the second tab, flip the muted flag back and forth. The query parameter now works correctly.

Any ideas why this is happening in Chrome and Firefox? I’m not using any browser addons and I can reproduce the bug on multiple devices.


#2

You may wanna go throw this up on the new github repo https://github.com/twitchdev/issues/issues


#3

It turns out the issue is caused by the browser’s autoplay policy.

Google’s autoplay policy states:

Autoplay with sound is allowed if:

  • User has interacted with the domain (click, tap, etc.).

This explains why toggling mute on twitch.tv fixed the muted flag in the embed url.

To fix the issue on Chrome, add the attribute allow=“autoplay” to the embed iframe. See their section on iframe delegation.