WebView Setting - Hybrid Application

    WebView Setting - Hybrid Application


    Article summary

    iOS WKWebview Setting

    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 Setting

    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.