HTML5 <video> element on Android

后端 未结 15 2345
逝去的感伤
逝去的感伤 2020-11-22 15:09

According to:

http://developer.android.com/sdk/android-2.0-highlights.html

Android 2.0 should support the HTML5 video element. I haven\'t been able to get th

15条回答
  •  不要未来只要你来
    2020-11-22 15:41

    According to : https://stackoverflow.com/a/24403519/365229

    This should work, with plain Javascript:

    var myVideo = document.getElementById('myVideoTag');
    
    myVideo.play();
    if (typeof(myVideo.webkitEnterFullscreen) != "undefined") {
        // This is for Android Stock.
        myVideo.webkitEnterFullscreen();
    } else if (typeof(myVideo.webkitRequestFullscreen)  != "undefined") {
        // This is for Chrome.
        myVideo.webkitRequestFullscreen();
    } else if (typeof(myVideo.mozRequestFullScreen)  != "undefined") {
        myVideo.mozRequestFullScreen();
    }
    

    You have to trigger play() before the fullscreen instruction, otherwise in Android Browser it will just go fullscreen but it will not start playing. Tested with the latest version of Android Browser, Chrome, Safari.

    I've tested it on Android 2.3.3 & 4.4 browser.

提交回复
热议问题