繁体   English   中英

在ipad上的HTML5视频标签上设置currentTime

[英]Setting currentTime on HTML5 video tag on ipad

我正在为ipad上的视频标签编写一个jQuery插件。 我的插件所做的一件事就是恢复播放你上次放弃观看它的电影。 我在设置当前时间时遇到问题。 我发现只能在“ stalled ”事件发生后设置它。 在电影开始播放后,这种停滞似乎会在ipad上发生(这是一个HTTP直播视频)。 我没有在其他环境中看到此事件,即PC上的谷歌浏览器。 所以这段代码有效,但我对使用stalled事件感到不舒服。 我尝试过canplaythroughplaying和其他人,在这些情况下,我对currentTime更新被忽略了。 有没有其他人有这方面的经验?

var theClass = this;
$(this.videoElement).bind("pause play stalled error abort progress waiting playing webkitfullscreenchange canplaythrough", null, function (e) {
    ///<summary>bind to the various events we are interested in during playback.  event state changes will be saved to
    ///local storage.  If we detect the media has finished playing we will exit fullscreen and trigger our mediaDone event</summary>
    if (e.type == "stalled" && theClass.resumeTriggered) {
        theClass.resumeTriggered = false;
        theClass.resumeTime = theClass.resumeTime + 0.1;

        $("#smpPlayerDebug").append("<p> seeking to time " + theClass.resumeTime + "</p>");
        e.srcElement.currentTime = theClass.resumeTime;
    }

它只是简单的不起作用。 iPad对控制视频播放的支持很弱,可能是因为苹果试图创造标准体验(不允许太多变化)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM