from Hacker News

Ask HN: How is YouTube able to autoplay videos with volume?

by linuxdeveloper on 10/31/23, 3:05 PM with 8 comments

How is YouTube the only site on the internet that is able to autoplay videos with volume?

I thought the browsers prevented that.

How are they doing this?

  • by LinuxBender on 10/31/23, 3:09 PM

    How is YouTube the only site on the internet that is able to autoplay videos with volume?

    They have a policy in Chrome [1]

    Chrome does this by learning your preferences. If you don’t have browsing history, Chrome allows autoplay for over 1,000 sites where we see that the highest percentage of visitors play media with sound. As you browse the web, that list changes as Chrome learns and enables autoplay on sites where you play media with sound during most of your visits, and disables it on sites where you don’t. This way, Chrome gives you a personalized, predictable browsing experience.

    [1] - https://stackoverflow.com/questions/59409015/how-can-youtube...

  • by ksherlock on 10/31/23, 6:55 PM

    Auto-play video with sound is allowed by browsers after you interact with a web page. Youtube is an SPA (you can tell because it often fucks up the back button) so when you click on video link, you're interacting and auto-play works. When you open in a new tab, it loads anew and won't auto-play because there hasn't been any interaction.

    https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_...

  • by tkiolp4 on 10/31/23, 7:50 PM

    Google owns YouTube and Chrome. They can do whatever they want with any of them.
  • by vhcr on 10/31/23, 11:03 PM

    It's not, Firefox works perfectly and blocks it from autoplaying.
  • by remyp on 11/1/23, 12:57 PM

    It's even more fun in Safari on MacOS. Videos don't autoplay, but they also don't play when you DO hit the play button.