我正在使用jQuery手机开发一个视频播放器,并在其中一个页面中使用以下代码嵌入HTML5视频:
<video id="Video" autoplay controls width="288" height="216">
<source id="MP4" type="video/mp4">
<source id="OGG" type="video/ogg">
Your browser does not support the video tag.
</video>然后,我使用以下jQuery代码来设置/更改要播放的视频:
$( document ).on( "click", ".Video", function(){
$("#Video").attr("poster", Thumb.jpg);
$("#MP4").attr("src", Video+".mp4");
$("#OGG").attr("src", Video+".ogg");
$("#Video").load();
});在iOS 6.1的iPod上访问时,第一个视频从头开始播放。但是,在观看第一个视频的几秒钟后,然后选择第二个视频,第二个视频将从第一个视频停止的时间点开始播放,而不是从头开始播放。
这段代码总是在Google Chrome和Nokia Windows phone中从头开始播放每个视频(我还没有机会尝试任何其他浏览器/设备)。
如何在iPod或任何其他设备上从头开始播放每个视频?
发布于 2013-12-01 12:37:59
处理搜索栏的示例代码如下:
var mediaElement = document.getElementById('mediaElementID');
mediaElement.seekable.start(); // Returns the starting time (in seconds)
mediaElement.seekable.end(); // Returns the ending time (in seconds)
mediaElement.currentTime = 122; // Seek to 122 seconds
mediaElement.played.end(); // Returns the number of seconds the browser has played在需要时使用此代码示例。每次用户选择新视频时,将currenttime设置为starttime。它将适用于所有浏览器。
这是我从developer.mozilla.org上得到的,标题是Seeking this 。
您可以查看HTMLMediaElement here的更多属性
希望能对你有所帮助。
https://stackoverflow.com/questions/20308665
复制相似问题