是否可以在网页中显示的html5 video中寻找特定点?我的意思是,我可以输入特定的时间值(例如01:20:30:045),让播放器控件(滑块)移至该点并从该点开始播放吗?

在旧版的Mozilla vlcplugin中,我认为可以通过seek(seconds,is_relative)方法实现。.但是我想知道在html视频中是否可行。

编辑:

我创建了带有视频的页面,并添加了如下所示的javascript。当我单击链接时,它会显示单击的时间。但是它不会增加播放位置。但是会继续正常播放。

视频播放位置是否应该更改?

html

<video id="vid" width="640" height="360" controls>
       <source src="/myvid/test.mp4" type="video/mp4" />
</video>
<a id="gettime" href="#">time</a>
<p>
you clicked at:<span id="showtime"> </span>
</p>

javascript
$(document).ready(function(){
    var player = $('#vid').get(0);
    $('#gettime').click(function(){
            if(player){
                current_time=player.currentTime;
                $('#showtime').html(current_time+" seconds");
                player.currentTime=current_time+10;
            }
        });
}
);

最佳答案

您可以使用v.currentTime = seconds;搜索到给定位置。

引用:https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime

关于html5-video - 在html5视频中寻找点,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10461669/

10-11 12:59
查看更多