1
votes

I'm trying to play embedded videos (youtube,vimeo,facebook,mp4) in a webview. I can play all except one case, youtube videos fullscreen in landscape mode. I have seen many answers on this problem but I can not find a solution to my case. I already tried put in the manifest.

android:hardwareAccelerated="true"
android:configChanges="orientation|screenSize"

and I'm using onShowCustomView(), onHideCustomView() from this website.

I saw a similar post with no replies. When youtube video goes to fullscreen the screen turns black and I can only hear the sound of the video.

1

1 Answers

0
votes

Try this - make custom implementation of WebChromeClient

class MyWebChromeClient extends (android.webkit.WebChromeClient as {new (): any}) {
        constructor() {
            super();
            return global.__native(this);
        }

        onShowCustomView(view: android.view.View, callback: android.webkit.WebChromeClient.CustomViewCallback) {
            callback.onCustomViewHidden();
        }

        onHideCustomView() {
            super.onHideCustomView();
        }
    }

Then you can do

let myWebChromeClient = new MyWebChromeClient();
this.webView.android.setWebChromeClient(myWebChromeClient);