HTML5视频搜索

Jus*_*per 14 javascript jquery html5 html5-video

如何让我的视频播放器跳过/寻找到某个时间.我已经开始使用它,它可以在页面首次加载(在Chrome中)但在任何其他浏览器中都无效.我也有一个闪回落,这可能是一个痛苦,但目前优先考虑的事情的HTML方面主要问题是它在Chrome之外不起作用!

编辑:这现在适用于IE9,Chrome和Firefox.但是,不是闪存后备!

以下是我到目前为止的尝试.

到目前为止我正在使用以下JS:

   <script language="javascript">
     $(function () {
     var v = $("#video").get(0);
         $('#play').click(function(){
                v.play();
         });

        $('.s').click(function(){
            alert("Clicked: "+$(this).html() +"- has time of -" + $(this).attr('s') );
            v.currentTime = $(this).attr('s'); v.play();
        });
     });
    </script>
Run Code Online (Sandbox Code Playgroud)

哪个链接到以下内容:

<video id="video" controls width="500">  
        <!-- if Firefox -->  
        <source src="video.ogg" type="video/ogg" />  
        <!-- if Safari/Chrome-->  
        <source src="video.mp4" type="video/mp4" />  
        <!-- If the browser doesn't understand the <video> element, then reference a Flash file. You could also write something like "Use a Better Browser!" if you're feeling nasty. (Better to use a Flash file though.) -->  
        <object type="application/x-shockwave-flash" data="player.swf"
        width="854" height="504">
            <param name="allowfullscreen" value="true">
            <param name="allowscriptaccess" value="always">
            <param name="flashvars" value="file=video.mp4">
            <!--[if IE]><param name="movie" value="player.swf"><![endif]-->
            <p>Your browser can’t play HTML5 video.</p>
  </object>
    </video>
Run Code Online (Sandbox Code Playgroud)

具有带有类s和自定义属性的按钮s=60为"60秒"等的上下文.

lon*_*ngi 11

seekToTime:function( value )
{
    var seekToTime = this.videoPlayer.currentTime + value;
    if( seekToTime < 0 || seekToTime > this.videoPlayer.duration ) 
        return;

    this.videoPlayer.currentTime = seekToTime;
}
Run Code Online (Sandbox Code Playgroud)

这是我们正在使用的搜索功能.这是MooTools的语法,但你会明白这一点.希望能帮助到你.