我正在尝试构建自定义视频播放器。
<video preload="metadata" id="videoPlayer" style="width: 640px; height: 360px;">
</video>
<script type="text/javascript">
var v = "";
var myVideo = "";
$(document).ready(function() {
v = $("#videoPlayer");
myVideo = v.get(0);
$(".playlist").click(function() {
v.attr("src","http://www.jplayer.org/video/webm/Big_Buck_Bunny_Trailer.webm");
myVideo.play();
});
myVideo.addEventListener('loadedmetadata', function() {
// in chrome it is working fine and shows the duration 00-00-33
// but in firox it is showing Infinity.
console.log(myVideo.duration);
});
});
<script>
在 chrome 中,视频正在播放并显示持续时间 33.02 。但是在fireox中它显示的是Infinity。所以我无法实现搜索栏。我想我错过了什么