我为HTML5视频播放器编写了HTML / JS代码,并且在Firefox 27.0.1版本中出现错误,在Ubuntu / Windows Chrome浏览器中有效,在IE11中运行。
的HTML
<div id="newprogressBar" style="border:1px solid #aaa; color:#fff; width:295px; height:20px;"><span id="newprogress" style="background-color:#ff0000; height:20px; display:inline-block;"></span></div>
HTML中的JS
var video = document.getElementById("videoPlayer"), (HTML5 <video *.mp4>)
newprogressBar = document.getElementById("newprogressBar");
newprogress = document.getElementById("newprogress");
JS中的事件函数
newprogressBar.addEventListener('click', function(event) {
width = parseFloat(newprogressBar.style.width);
var x = event.offsetX / width;
video.currentTime = Math.round(x * video.duration);
}, false);
我在Firefox的这一行有一个错误
video.currentTime = Math.round(x * video.duration);
错误:
TypeError: Value being assigned to HTMLMediaElement.currentTime is not a finite floating-point value.
检查video标签内的.webm视频文件。Linux(也可能是其他操作系统)上的Firefox无法播放.mp4文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句