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 将来就不支持了,所以最好不要用。

    明白了吗?

    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配