【问题标题】:Flutter : How to block full screen video in webview?Flutter:如何在 webview 中阻止全屏视频?
【发布时间】:2021-05-19 15:35:09
【问题描述】:

我在我的 Flutter 应用程序中使用“webview_flutter: ^1.0.7”插件来打开 web 视图,但是当网站在屏幕上的任意位置单击并全屏打开后启动视频时出现问题。如何在不禁用 javascript 的情况下禁用它?我想播放视频但不是全屏

我不能使用“AutoMediaPlaybackPolicy”,因为有一个动作

【问题讨论】:

    标签: flutter flutterwebviewplugin


    【解决方案1】:

    一种方法是更新 html 文件:

        String hmtlCode = (await http.get(initialUrl)).body;
        # edit this code (either append to string, or find and replace)
    
    

    https://itqna.net/questions/80033/how-disable-full-screen-html5-video-any-browser(html 示例如何禁用全屏)

    然后将此 html 提供给 webview

    String hmtlCode = ....;
    String url = Uri.dataFromString(hmtlCode, mimeType: 'text/html', encoding: Encoding.getByName('utf-8')).toString();
    WebView(
       initialUrl: url,
       ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多