Android webview html5 video autoplay not working on android 4.0.3

后端 未结 4 1784
滥情空心
滥情空心 2020-12-08 23:50

I have developed an application where the user can set videos on a web page: - They can specify a Youtube URL OR - They can upload a video

Depending on which option

4条回答
  •  悲&欢浪女
    2020-12-09 00:21

    Auto-play is disabled since Android SDK 17, but you can set setMediaPlaybackRequiresUserGesture to false to re-enable auto-play. Don't forget to check the SDK version because there is not such function in earlier versions.

        int SDK_INT = android.os.Build.VERSION.SDK_INT;
        if (SDK_INT > 16) {
            engine.getSettings().setMediaPlaybackRequiresUserGesture(false);
        }
    

提交回复
热议问题