I wanted to ask whether there actually is any way possible to auto play a video without the muted
attribute? I thought it might be possible somehow since when you click on a YouTube video link, it auto plays. Thanks for your answers in advance~
Basically auto play video with sound when page loads, if I open a YouTube link it plays the video and audio as well, then it must be possible right?
Start by reading the official guidance: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide for clarification.
The way YouTube does it is (I think) by having a SPA, i.e. a Javascript-based site. When you click on a thumbnail, it doesn't load a different page, it just changes the contents of the current page via Javascript. Thus the user has interacted with the current page and triggered the video playback through their action, allowing full audible playback.
Also note this point from the article:
As a general rule, you can assume that media will be allowed to autoplay [..] if the site has been allowlisted; this may happen [..] automatically if the browser determines that the user engages with media frequently [..]
I'm fairly sure I've had to click Play explicitly a few times on YouTube; possibly on a "new" device when I came to a video page from an external page. But once you have played a couple of videos on YouTube, it probably becomes allowlisted implicitly. I'm pretty sure that clause exists specifically for YouTube and similar video sites so as not to undermine their business model.
If you load a new page which contains an audible <video autoplay ...>
element, that will generally be blocked, and there isn't really anything you can do about it.