0

I am using native script-angular framework to develop android and ios applications. In my application I am loading youtube video using embed code in webview. The video was loading perfectly both android and ios phones and tablets, but the expand icon inside the youtube frame disabled by default in android devices and iPad's in ios platform. In ios phones, the youtube videos automatically expanded. How to solve the issue?

My Html code for loading youtube video inside webview

<WebView src='<Html><Body><iframe width="100%" height="300"  src="https://www.youtube.com/embed/EXeTwQWrcwY" frameborder="0"  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></Body></Html>' width="100%" height="100%" ></WebView>

My ts code:

webviewLoaded(args)
{
    const webview = args.object;
    if (isAndroid) {
        webview.android.getSettings().setJavaScriptEnabled(true);
        webview.android.getSettings().setAppCacheEnabled(true);
        webview.android.getSettings().setBuiltInZoomControls(true);
        webview.android.getSettings().setSaveFormData(true);


    }

}

Sample screen shot: enter image description here

Arigarasuthan
  • 315
  • 1
  • 8
  • 17
  • Android's WebView doesn't handle most of browser features by default including fullscreen option. You will have to implement [WebChromeClient](https://developer.android.com/reference/android/webkit/WebChromeClient) and assign it to WebView, [Here](https://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview) is an example how it's implemented, you may have to translate it to JavaScript using [android marshalling guide](https://docs.nativescript.org/core-concepts/android-runtime/marshalling/overview). – Manoj Oct 04 '19 at 12:45
  • Any other way it's too complicated for me.Please help any other solution – Arigarasuthan Oct 05 '19 at 04:41
  • Can you suggest some video player plugin for nativescript angular? @Manoj – Arigarasuthan Oct 05 '19 at 07:24
  • If you are not looking for embedded content specifically, you could try the native YouTube video player plugin. – Manoj Oct 05 '19 at 08:00
  • Thank you manoj..i had used youtube player plugin to achieve expand icon enabled in android and also the video expanded. but in iPad the expand icon disabled by default. in iPhone it was worked. – Arigarasuthan Oct 07 '19 at 11:29

0 Answers0