创建具有相同源的两个HTML5视频元素不起作用 [英] Creating two HTML5 video elements with the same source not working

查看:76
本文介绍了创建具有相同源的两个HTML5视频元素不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力做一件简单的事情,但到目前为止我没有取得任何成功,我无法理解为什么它不起作用。

I am trying to do a simple thing but so far I have not had any success and I cannot get why it does not work.

我需要两个(或几个,就此而言)HTML5视频元素播放相同的视频,但它不起作用。以下是我一直在尝试的代码: http://jsfiddle.net/4K8DZ/

I need two (or several, for that matter) HTML5 video elements to play the same video, but it does not work. Here is the code I have been trying: http://jsfiddle.net/4K8DZ/

关于为什么会有任何想法?

Any ideas on why is that?

谢谢

推荐答案

我自己遇到了这个问题。我通过向第二个视频元素源的源文件添加查询参数来解决这个问题:

Just ran into this problem myself. I worked around it by adding a query param to the source file of the second video element’s source:

video1.setAttribute("src", "whatever.mp4");
video2.setAttribute("src", "whatever.mp4?random=1");

http://jsfiddle.net/br2bn/

这篇关于创建具有相同源的两个HTML5视频元素不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆