jquery – html5视频的当前/持续时间?

我需要一种获取视频的总时间长度和使用jQuery的当前时间的方式,并以几个< div>标签
<div id="current">0:00</div>
<div id="duration">0:00</div>

我一直在搜索,我知道如何让他们,我不能显示它们。 #jquerynoob

解决方法

HTML:
<video
    id="video-active"
    class="video-active"
    width="640"
    height="390"
    controls="controls">
    <source src="myvideo.mp4" type="video/mp4">
</video>
<div id="current">0:00</div>
<div id="duration">0:00</div>

JavaScript:

$(document).ready(function(){
  $("#video-active").on(
    "timeupdate",function(event){
      onTrackedVideoFrame(this.currentTime,this.duration);
    });
}

function onTrackedVideoFrame(currentTime,duration){
    $("#current").text(currentTime);
    $("#duration").text(duration);
}

笔记:

Every 15 to 250ms,or whenever the MediaController’s media controller
position changes,whichever happens least often,the user agent must
queue a task to fire a simple event named timeupdate at the
MediaController.

http://www.w3.org/TR/html5/embedded-content-0.html#media-controller-position

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...