简体   繁体   中英

Chrome not play html5 video on duplicated tags

On my page i have two video tags vith same video source. Example:

<video id="video_description_html5_api" class="vjs-tech" poster="poster.jpg" preload="metadata">
<source src="video.mp4.ogv" type="video/ogg">
<source src="video.mp4.mp4" type="video/mp4">
<source src="video.mp4.webm" type="video/webm">
</video>

<video id="video_preview" class="vjs-tech" poster="poster.jpg" preload="metadata">
<source src="video.mp4.ogv" type="video/ogg">
<source src="video.mp4.mp4" type="video/mp4">
<source src="video.mp4.webm" type="video/webm">
</video>

When i start to play one of these videos in Google Chrome and then try to play second - last one not loading. this bug/feature only in chrome. firefox play both video at the same time correctly.

Any idea how can i force to play second video?

(Commenter @Hamza Kubba came up with the answer that original poster reports solved the problem for them, but it's in the comments. Copying/pasting here as an answer, where it belongs.)

...try adding ?1 to the video URLs: <source src="video.mp4.ogv?1" type="video/ogg"> <source src="video.mp4.mp4?1" type="video/mp4"> <source src="video.mp4.webm?1" type="video/webm"> The downside is that the videos will have to be loaded twice, so this isn't ideal... I'm assuming there's a bug with chrome keeping it from playing the same source on the same page twice, btw. I didn't notice any problems with your code.

...keep in mind, chrome will load the video files twice into memory, and twice from the server, using this method. However, I'm not sure there's a good alternative until Chrome fixes this bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM