我正在尝试在WebView中播放直播电视。 WebView在页面中显示黑屏直播区域,但它没有加载和播放流。
wv.setWebChromeClient(new WebChromeClient()); (mainactivity)
和
android:hardwareAccelerated =" true" (manifest.xml)无法正常工作
wv = (WebView) findViewById(R.id.wv);
wv.setWebChromeClient(new WebChromeClient());
wv.getSettings().setPluginState(WebSettings.PluginState.ON);
wv.getSettings().setJavaScriptEnabled(true);
wv.setFocusable(true);
wv.setFocusableInTouchMode(true);
wv.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
wv.getSettings().setDomStorageEnabled(true);
wv.getSettings().setDomStorageEnabled(true);
wv.getSettings().setAppCacheEnabled(true);
wv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
wv.loadUrl("http://www.fox.com.tr/canli-yayin");
wv.setWebViewClient(new WebViewClient());
答案 0 :(得分:0)
Mobile.So不支持所有直播。首先检查您的网址是否在Chrome浏览器中运行。如果它正常工作,那么您可以使用自定义选项卡
compile 'com.android.support:customtabs:23.3.0'
String url = ¨http://www.fox.com.tr/canli-yayin¨;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));
答案 1 :(得分:0)
您必须为视频流设置此网络视图设置
mWebview.Settings.JavaScriptEnabled = true;
mWebview.Settings.SupportZoom();
mWebview.Settings.SetAppCacheEnabled(true);
mWebview.Settings.DomStorageEnabled = true;
mWebview.ZoomOut();
mWebview.ZoomIn();
mWebview.Settings.BuiltInZoomControls = true;
mWebview.Settings.LoadWithOverviewMode = true;
mWebview.Settings.UseWideViewPort = true;
if (Build.VERSION.SdkInt > BuildVersionCodes.Lollipop)
mWebview.Settings.MixedContentMode = MixedContentHandling.CompatibilityMode;
mWebview.Settings.SetPluginState(WebSettings.PluginState.On);
mWebview.Settings.GetPluginState();
mWebview.Settings.AllowFileAccess = true;
如果要在应用程序中打开流,请设置webview的webviewclient。
mWebview.SetWebViewClient(new WebViewClient());
如果事件无效,请设置webview用户代理字符串
webview.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");