简体   繁体   English

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

[英]Setting currentTime on HTML5 video tag on ipad

I'm writing a jQuery plugin for the video tag on the ipad. 我正在为ipad上的视频标签编写一个jQuery插件。 One of the things my plugin does is resumes playing a movie where you last quit watching it. 我的插件所做的一件事就是恢复播放你上次放弃观看它的电影。 I'm having issues setting current time. 我在设置当前时间时遇到问题。 I've found I can only set it after the " stalled " event has fired. 我发现只能在“ stalled ”事件发生后设置它。 The stalled seems to fire on an ipad after a movie starts playing (this is an HTTP live stream video). 在电影开始播放后,这种停滞似乎会在ipad上发生(这是一个HTTP直播视频)。 I don't see this event in other environments ie google chrome on a PC. 我没有在其他环境中看到此事件,即PC上的谷歌浏览器。 So this code works but I feel uncomfortable using the stalled event. 所以这段代码有效,但我对使用stalled事件感到不舒服。 I've tried canplaythrough , playing and others and in those cases my update to currentTime is ignored. 我尝试过canplaythroughplaying和其他人,在这些情况下,我对currentTime更新被忽略了。 Does anyone else have experience with this? 有没有其他人有这方面的经验?

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;
    }

It just plain doesn't work. 它只是简单的不起作用。 The iPad's support for controlling video play is weak, probably in Apple's attempt to create a standard experience (not allowing too much variation). iPad对控制视频播放的支持很弱,可能是因为苹果试图创造标准体验(不允许太多变化)。

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

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