admin 管理员组文章数量: 1086019
Does anyone know of a workaround (JavaScript, I'd guess) for looping HTML5 <video>
elements in Firefox. The loop
attribute isn't currently supported in Firefox.
Does anyone know of a workaround (JavaScript, I'd guess) for looping HTML5 <video>
elements in Firefox. The loop
attribute isn't currently supported in Firefox.
4 Answers
Reset to default 5Please do not abuse jQuery like this!! You don't need a massive library to bind a simple listener! Use this:
document.getElementById('video').addEventListener("ended", function(){this.play();});
This will trigger when the video ends. The anonymous function will then be ran. "this" refers to the video element by which we execute the play function on causing the video to re-play.
Shame on Firefox for letting this bug go unfixed for so long!
None of the answers here worked for me with Firefox on OS X.
My solution was to add loop="loop" to the video tag. Omitting the ="loop" caused the video not to loop.
<video src="myvid.mp4" loop="loop"></video>
Don't have any videos to test with but found a solution on the firefox support forums using jQuery that you can try out:
$("#yourID").bind('ended', function(){
this.play();
});
http://support.mozilla./en-US/questions/747220
A JQuery workaround as nabbed from Mozilla's site worked for me ( http://support.mozilla./en-US/questions/747220 ):
$("#yourID").bind('ended', function(){
this.play();
});
本文标签: javascriptWorkaround for ltvideogt loop attribute in FirefoxStack Overflow
版权声明:本文标题:javascript - Workaround for <video> loop attribute in Firefox - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744040325a2523133.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论