I make a web page that leads stream from youtube, how can I get the video to start with the sound when I launch the page? If I start with an IFrame without the mute=1 parameter, the video does not start, if with it, everything works, but then in the code, when I use .unMute() browser curses and stops the video, since user did not interact with him.
- This is the wrong behavior of the site, where a video with sound is launched without user initiation. Therefore, make some kind of functionality for the user to control the sound, not the script - Alexandr Tovmach
2 answers
Yes. This is a new (already 6 months if the memory does not change) update Google Chrome. And now Chrome is very much swearing at sites with autoplay sound and not only. You can read about it here: Chrome ad blocking
- Yes, I read, but they say it can be bypassed - Kayrosik
- You can set the volume to the minimum value of 0.005. But this crutch was promised to be fixed - Alexandr Tovmach
According to the new standards adopted in April 2018, and finally entered into force in December 2018:
- Playing "Silent" is always allowed.
Autoplay "With Sound" is allowed if:
- The user initiated the reproduction himself, from one domain (click, tap, etc.).
- On desktop devices, the video is trusted by the Media Engagement Index and / or reproduced earlier by the same user.
- On mobile devices, this resource has been added to the main screen (see PWA )
- Autoplay permission is delegated from the upper frames.
How to get around?
The hack still works with setting the minimum and inaudible volume level: 0.005 , and initiating the video for any user action, and then waving up the volume as needed. But this was also promised to be fixed, so this is also Bad Practice.
Board
Do not build a bike from hacks and follow the conventions, otherwise your work will never work properly.