我观察到一种奇怪的行为,即Firefox(独家)开始播放嵌入页面中的所有视频的声音,即使这些元素本身没有播放。意思是:如果您在视频控件上单击“播放”,则会启动新的声音和视频播放(如您所料)。
视频元素都有3个不同的源文件,可以满足所有主流浏览器的需求,如下面的代码所示。
我尝试将autostart="false"
添加到代码中,并在加载DOM时在每个视频元素上调用.pause()
。两者都没有效果。
我错过了一些明显的东西吗?
<video id="movie1" class="movie" width="434" controls >
<param name="allowFullScreen" value="false"/>
<source src="video/vid1.webm" type='video/webm'>
<source src="video/vid1.ogv" type='video/ogg'>
<source src="video/vid1.mp4" type='video/mp4'>
<object data="video/vid1.mp4" width="434"></object>
Your browser doesn't support the HTML5 videos, we're sorry. <br/>
Try switching your browser to view the videos.
</video>
<video id="movie2" class="movie" width="434" controls >
<source src="video/vid2.webm" type='video/webm'>
<source src="video/vid2.ogv" type='video/ogg'>
<source src="video/vid2.mp4" type='video/mp4'>
<object data="video/vid2.mp4" width="434"></object>
Your browser doesn't support the HTML5 videos, we're sorry. <br/>
Try switching your browser to view the videos.
</video>
<video id="movie3" class="movie" width="434" controls >
<source src="video/vid3.webm" type='video/webm'>
<source src="video/vid3.ogv" type="video/ogg">
<source src="video/vid3.mp4" type='video/mp4'>
<object data="video/vid3.mp4" width="434"></object>
Your browser doesn't support the HTML5 videos, we're sorry. <br/>
Try switching your browser to view the videos.
</video>
答案 0 :(得分:0)
这是object
元素,这些天似乎不再需要了。没有它就可以正常工作!