在线音频流网站无法在WebView上正常工作 [英] Online audio streaming websites are not working properly on WebView
本文介绍了在线音频流网站无法在WebView上正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试从WebView
上的gaana.com
或saavn.com
等在线音频流媒体网站播放在线音频歌曲.
I try to play online audio songs from online audio streaming websites like gaana.com
or saavn.com
etc. on WebView
.
我的代码:
WebView webView = findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient());
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("https://gaana.com/");
网站已正确加载到webview中,但问题是当我单击播放(对于任何歌曲)时,什么都不会发生.,即,webview中没有任何响应.
Websites are loaded in webview correctly but the problem is that when I click on play(for any song) nothing will happen. i.e, no any response show in webview.
我的清单文件:
<manifest package="biz.coolpage.aashish.app"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="biz.coolpage.aashish.app.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.Translucent.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="true" />
</activity>
</application>
</manifest>
谢谢您的帮助.
推荐答案
尝试添加android:hardwareAccelerated="true"
放入manifest
中的activity
标记中.
然后添加代码:
Try to add android:hardwareAccelerated="true"
into activity
tag in manifest
.
And then add code:
WebView webView = findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient());
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowContentAccess(true);
webSettings.setDomStorageEnabled(true);
webView.loadUrl("https://gaana.com");
https://developer.android.com/guide/topics/graphics/hardware-accel.html
这篇关于在线音频流网站无法在WebView上正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文