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

5

我正在编写一个jQuery插件,用于iPad上的视频标签。其中一个功能是在你上一次停止观看的位置恢复播放电影。我遇到了设置当前时间的问题。我发现只有在“stalled”事件被触发后才能设置它。在iPad上,stalled事件似乎会在电影开始播放后触发(这是一个HTTP实时流视频)。我在其他环境中(如PC上的Google Chrome)没有看到这个事件。所以这段代码是工作的,但是我对使用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;
    }
1个回答

1

它根本不起作用。iPad对于控制视频播放的支持很弱,可能是为了创建标准体验(不允许太多变化)。


2
或者苹果不关心标准 :) - obenjiro

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接