Android WebView中的Netflix [英] Netflix in Android WebView

查看:66
本文介绍了Android WebView中的Netflix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,让我开始说这是不可行的做法,那就是下载Netflix App.因此,我的想法是只制作一个包装应用程序,以在WebView中加载netflix网站.这适用于登录/导航;但是,每当您单击播放按钮开始播放视频时,logcat中都没有响应,也没有输出.我正在寻找一种从WebView查看更多调试消息的方法,或者一种使视频播放的方法.顺便使用Android 4.4.4.

So let me preface this by saying downloading the Netflix App is not an option. So my thought is to just make a wrapper app that loads the netflix website in a WebView. This works for login/navigation; however, whenever you hit the play button to start playing the video, there is no response and no output in logcat. I'm looking for a way to see more debug messages from the WebView or a way to get the video playing. Using Android 4.4.4 by the way.

View layout = LayoutInflater.from(mActivity).inflate(R.layout.main_layout, vContentAreaContainer, false);

WebView webView = (WebView) layout.findViewById(R.id.main_web_view);
            webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setDomStorageEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());

webView.loadUrl("http://www.netflix.com");
vContentAreaContainer.addView(layout);

推荐答案

您可以在Android Webview中加载Netflix,但由于以下原因将无法播放Netflix视频:

You can load Netflix in Android Webview but wont be able to play Netflix videos because:

  • 如果用户代理是移动设备,则Netflix将使用基于意图的URL模式.此意图由Netflix App处理,如果设备未安装Netflix来处理它们,则将显示安装Netflix屏幕".

  • if user agent is mobile device than Netflix will use intent based url schema. This intents are handled by Netflix app and if device dont have Netflix installed to handle them then "install Netflix screen" will be shown.

如果您手动将用户代理设置为桌面,则Netflix将要求安装 Microsoft Silverlight插件,该插件仅适用于Mac和Windows.因此,您将再次陷入僵局.

If you manually set user agent to desktop then Netflix will ask to install Microsoft Silverlight Plugin which is available only for Mac and Windows. So again you will reach a dead end.

     webView.setScrollbarFadingEnabled(false)

     val newUA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) 
         AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50"

    webView.getSettings().setUserAgentString(newUA)

这篇关于Android WebView中的Netflix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆