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

use*_*391 5 javascript video jquery html5 ipad

我正在为ipad上的视频标签编写一个jQuery插件.我的插件所做的一件事就是恢复播放你上次放弃观看它的电影.我在设置当前时间时遇到问题.我发现只能在" stalled"事件触发后设置它.在电影开始播放后,这种停滞似乎会在ipad上发生(这是一个HTTP直播视频).我没有在其他环境中看到此事件,即PC上的谷歌浏览器.所以这段代码有效,但我觉得使用这个stalled事件很不舒服.我已经尝试了canplaythrough,playing其他人在这些情况下我的更新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;
    }
Run Code Online (Sandbox Code Playgroud)

Bre*_*olt 1

这显然是行不通的。iPad 对控制视频播放的支持很弱,可能是苹果试图创建标准体验(不允许有太多变化)。

  • ..或者苹果不关心标准:) (2认同)