WebView setting: Hybrid application

    WebView setting: Hybrid application


    Article summary

    iOS WKWebview settings

    allowsInlineMediaPlayback

    To allow inline playback of video tags in WKWebView, you need to set the allowsInlineMediaPlayback property of WKWebViewConfiguration to true. This will ensure that the player functions normally.

    let configuration = WKWebViewConfiguration()
    configuration.allowsInlineMediaPlayback = true
    let webView = WKWebView(frame: rect, configuration: configuration)
    • For more information on the allowsInlineMediaPlayback property, please refer to the documentation.


    Android Webview settings

    mediaPlaybackRequiresUserGesture

    To enable automatic playback of Shortform in Android Webview, you need to set the mediaPlaybackRequiresUserGesture property to false. This property determines whether or not a user gesture is required to start playback of a video. When set to false, videos will start playing automatically, even if the user does not interact with the webview.

    webView.getSettings().setMediaPlaybackRequiresUserGesture(false)
    • For more information on the mediaPlaybackRequiresUserGesture property, please refer to the documentation.