Supports firefox automatic playback Google, ie does not support automatic playback
<video controls=controls autoplay=autoplay name=media><source src=./img/music.mp3 type=audio/mpeg></video>
Google can use muted to achieve automatic playback by adding muted
<video controls=controls autoplay=autoplay name=media muted><source src=./img/music.mp3 type=audio/mpeg></video>
The principle is that most browsers support silent video playback
<video controls=controls autoplay=autoplay name=media muted><source src=http://vjs.zencdn.net/v/oceans.mp4 type=audio/mpeg></video>2.audio tags
Note: Tags define sounds, such as music or other audio streams.
<audio controls=controls ><source src=./img/music.mp3></audio>
Note: Only music cannot load videos
3.embedCan support multiple players
Automatic playback supports Android, not iOS, support Google, ie ie edge, not firefox
<embed src=./img/music.mp3 hidden=true autostart=true loop=true> <embed src=http://vjs.zencdn.net/v/oceans.mp4 autostart=true loop=true>Additional Notes:
The inability to automatically play sound has always been a convention on IOS/Android. The desktop version of Safari also announced the ban on the multimedia autoplay function with sound in version 11 of 2017. Then, Chrome 66 released in April 2018 officially turned off the automatic playback of sound, which means that <audio autopaly> <video autoplay> will also be invalid in the desktop version of the browser.
Google Note: Autoplay exception: We have mentioned above that if the video itself has been set to mute, the browser will no longer intercept its load for automatic playback. At the same time, if the user has clicked on automatic play before, then the browser will not intercept its playback by default. On mobile devices, if the user chooses to add the website to the home screen, that is, the website you frequently visit, it can also play automatically.Finally: According to Google statistics, if the website video is played in large quantities such as video websites, the automatic playback function will not be blocked in this case.
This is the article about the implementation example of adding music videos on html web pages. For more related html video content, please search for previous articles from Wulin.com or continue browsing the related articles below. I hope everyone will support Wulin.com in the future!