ZZ码农 2017-05-03 04:47 采纳率: 0%
浏览 3407

webview加载网页视频时,提示无法加载插件

安卓6.0使用webview展示网页时,其他文本图片信息正常,但是无法展示网页中的视频。

并在视频播放的位置提示无法加载插件。(手机安装flash了呀- -)

看了网上一些解决webview解决视频播放问题的帖子。
比如在manifest中对应的activity中添加android:hardwareAccelerated="true"属性,

在java文件中,设置webSettings.setDomStorageEnabled(true);和webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);等属性均解决问题。。。。

使用webView .getSettings().setPluginsEnabled(true);时爆红。
  • 写回答

2条回答 默认 最新

  • 白萝卜。 2017-05-03 05:28
    关注

    咱们先看下源码里面怎么说的:
    /**
    * Sets whether the WebView should enable plugins. The default is false.
    *
    * @param flag true if plugins should be enabled
    * @deprecated This method has been deprecated in favor of
    * {@link #setPluginState}
    * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
    */
    @SystemApi
    @Deprecated
    public abstract void setPluginsEnabled(boolean flag);

    意思是说这个过期了,建议使用setPluginState这个方法。
    然后接着看setPluginState方法:
    /**
    * Tells the WebView to enable, disable, or have plugins on demand. On
    * demand mode means that if a plugin exists that can handle the embedded
    * content, a placeholder icon will be shown instead of the plugin. When
    * the placeholder is clicked, the plugin will be enabled. The default is
    * {@link PluginState#OFF}.
    *
    * @param state a PluginState value
    * @deprecated Plugins will not be supported in future, and should not be used.
    */
    @Deprecated
    public abstract void setPluginState(PluginState state);

    意思是说这个也过期了,因为Plugins 将来就不支持了,所以最好不要用。

    明白了吗?

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮