Why are videos in android webview playing in Android 8 and below but not in 9 and above?

0

I have been working on an android app that plays videos hosted on a remote server in Web-view. The app is working perfectly except on android 9 and 10 releases where its acting like the link to the videos is breaking. see the image showing after attempting to play the video

The app also uses JSBridge for javascript in the html to access android native functions. Kindly help with why the app is behaving in this manner. see the code below. ` wv = (WebView)findViewById(R.id.g10_notes);

    progressBar = findViewById(R.id.progressBar);
    progressRing = findViewById(R.id.progressRing);

    // set javascript and zoom and some other settings
    wv.getSettings().setAppCacheEnabled(true);
    wv.getSettings().setDatabaseEnabled(true);
    wv.getSettings().setDomStorageEnabled(true);
    wv.getSettings().setLoadsImagesAutomatically(true);
    wv.getSettings().setDefaultTextEncodingName("UTF-8");
    wv.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    wv.getSettings().setAllowFileAccess(true);
    wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    wv.getSettings().setBuiltInZoomControls(false);
    wv.getSettings().setUseWideViewPort(true);
    wv.addJavascriptInterface(new WebAppInterface(this), "JSBridge");
    // 3RD party plugins (on older devices)

    wv.getSettings().setPluginState(WebSettings.PluginState.ON);
    wv.getSettings().setJavaScriptEnabled(true);


    wv.setInitialScale(100);
    wv.setBackgroundColor(0xFFFFFFFF);
    wv.setVerticalScrollBarEnabled(true);
    wv.setHorizontalScrollBarEnabled(false);

    // Below required for geolocation
    //webView.setGeolocationEnabled(true);

    wv.setFocusable(true);
    wv.setFocusableInTouchMode(true);
    wv.setSaveEnabled(true);

    wv.setWebViewClient(new MainWebViewClient());
    wv.setWebChromeClient(new MainWebChromeClient());
    wv.requestFocus();`

html video tag

`    <div>
<video id="video4"
       preload="none"
       src="http://66.45.248.248/video_tutrls/Maths10/Algebra/Example_alg_4.mp4"
       onplay="sendPlay('video4')"
       controls>
</video>

`

javascript
java
android
html
asked on Stack Overflow May 13, 2020 by KenC

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0