在线音频流网站无法在WebView上正常工作

编程入门 行业动态 更新时间:2024-10-19 08:49:07
本文介绍了在线音频流网站无法在WebView上正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试从WebView上的gaana或saavn等在线音频流媒体网站播放在线音频歌曲.

I try to play online audio songs from online audio streaming websites like gaana or saavn etc. on WebView.

我的代码:

WebView webView = findViewById(R.id.webView); webView.setWebViewClient(new WebViewClient()); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webView.loadUrl("gaana/");

网站已正确加载到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="schemas.android/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("gaana");

developer.android/guide/topics/graphics/hardware-accel.html

更多推荐

在线音频流网站无法在WebView上正常工作

本文发布于:2023-11-01 12:49:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549379.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:在线   流网   音频   工作   WebView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!