cav dit
cav dit

Reputation: 43

how to solve problem webview to play audio

i use my site in WebView to create app of my site. my site has one section to play sounds from other site. my site is https and other site is http .when want play the song get this error from android studio

    E/EGL_emulation: eglQueryContext 32c0  EGL_BAD_ATTRIBUTE
E/EGL_emulation: tid 3170: eglQueryContext(1456): error 0x3004 (EGL_BAD_ATTRIBUTE)
I/chromium: [INFO:CONSOLE(0)] "Mixed Content: The page at 'https://mysiteurl' was loaded over HTTPS, but requested an insecure video 'http://othersiteurl'. This request has been blocked; the content must be served over HTTPS.", source: https://mysiteurl (0)
I/chromium: [INFO:CONSOLE(0)] "Uncaught (in promise) NotSupportedError: Failed to load because no supported source was found.", source: undefined (0)

how i can solve this problem

Upvotes: 2

Views: 2398

Answers (1)

mehdi farhadi
mehdi farhadi

Reputation: 1532

you must add

android:usesCleartextTraffic="true"

to application tage in AndroidManifest.xml and add

if (Build.VERSION.SDK_INT >= 21) {
        mWebView.getSettings().setMixedContentMode( WebSettings.MIXED_CONTENT_ALWAYS_ALLOW );
}

into OnCreate Your Activity

Upvotes: 2

Related Questions