Chrome doesn't play html5 video on duplicate tags

On my page, I have two video tags with the 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 playing one of these videos in Google Chrome, and then try to play the second - the last, not downloadable. This error / function is only in chrome. firefox plays both videos at the same time correctly.

Any idea how I can get the second video to play?

+6
source share
1 answer

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

... try adding? 1 to 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 disadvantage is that the video will need to be downloaded twice, so this is not perfect ... I assume that there is an error with chrome-plating from one the same source on the same page twice, by the way. I did not notice any problems with your code.

... remember that chrome will load video files twice into memory and twice from the server using this method. However, I'm not sure if there is a good alternative until Chrome fixes this error.

0
source

Source: https://habr.com/ru/post/955962/


All Articles