HTML5 video player behavior on iPhone and iPod in Safari Web Apps

后端 未结 2 1486
执笔经年
执笔经年 2020-12-02 12:28

On the iPhone and iPod, if a YouTube video is embedded in a web page, the user can touch the video and the video will start playing—the iOS media player slides in and the vi

相关标签:
2条回答
  • 2020-12-02 13:24

    Hm, can't try that myself...but sure you've seen this?

    http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html#//apple_ref/doc/uid/TP40009356

    So, "webkitEnterFullScreen()" might be your friend (although the doc says its read-only):

    http://nathanbuskirk.com/?p=1

    Inline video is not possible on any iOS device beside iPad (so far).

    Anyway, you may detect the end of a video in Javascript by using an Event Listener:

    document.getElementById('video').addEventListener('ended',videoEndListener,false);
    

    Cheers,

    Jan

    0 讨论(0)
  • 2020-12-02 13:27

    From the Safari documentation:

    "Important: The webkitEnterFullscreen() method can be invoked only in response to a user action, such as clicking a button. You cannot invoke webkitEnterFullscreen() in response to an onload() event, for example."

    That might explain why your webkitEnterFullscreen is always false.

    http://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html#//apple_ref/doc/uid/TP40009523-CH3-SW13

    Jan's solution handling the 'ended' event is the best in your case.

    0 讨论(0)
提交回复
热议问题