Website add music video mode

Note: Different browsers will show different styles of the control panel.

1.video label

 

Autoplay support firefox Google, ie does not support automatic playback

<video controls="controls" autoplay="autoplay" name="media"><source src="./img/music.mp3" type="audio/mpeg"></video>

Google Play can be achieved by automatically adding muted by Mute

<video controls="controls" autoplay="autoplay" name="media" muted><source src="./img/music.mp3" type="audio/mpeg"></video>

The principle is supported by most browsers in muted 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 label

Note: tag defines sound, such as music or other audio streams.

<audio controls="controls" ><source src="./img/music.mp3"></audio>

Note: You can not load music video

3.embed

It can support a variety of players

Autoplay support Android, do not support the ios, ie ie edge support Google does not support 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 information:

声音无法自动播放这个在 IOS/Android 上面一直是个惯例,桌面版的 Safari 在 2017 年的 11 版本也宣布禁掉带有声音的多媒体自动播放功能,紧接着在 2018 年 4 月份发布的 Chrome 66 也正式关掉了声音自动播放,也就是说 <audio autopaly> <video autoplay>在桌面版浏览器也将失效。
谷歌说明:
可自动播放例外条件:上面我们已经提到如果视频本身已经被设置为静音的情况下,那么浏览器将不会再拦截其加载进行自动播放。同时如果用户此前点击过自动播放的话那么下次再访问同样的网站,那么浏览器默认情况也不会拦截其播放,而在移动设备上如果用户选择将网站添加到主屏幕上也就是经常访问的网站,这种情况下同样可以自动播放。最后:根据谷歌统计数据如果网站视频被大量播放例如视频网站,这种情况下也不会被拦截掉自动播放功能

Guess you like

Origin www.cnblogs.com/zjx304/p/10278144.html