【问题标题】:Embedded YouTube video in WebView does not respect full screen settingsWebView 中嵌入的 YouTube 视频不遵守全屏设置
【发布时间】:2012-07-20 09:13:12
【问题描述】:

我正在使用the guide displayed over here 在 WebView 控制器中嵌入视频。

WebView 位于主题为 Theme.Dialog 的 Activity 中

嵌入的视频首先在活动中显示缩略图。我使用fs=0 禁用全屏选项。

按下播放按钮后,视频以 HTML5 模式加载(我认为),然后它不尊重我设置的全屏设置。

如何在 HTML5 模式下禁用全屏设置?

我的HTML代码如下。

public String getHTML() {
        String html = "<iframe class=\"youtube-player\" style=\"border: 0; width: 100%; height: 95%; padding:0px; margin:0px\" id=\"ytplayer\" type=\"text/html\" src=\"http://www.youtube.com/embed/"
                + "k8GzqXg2ugA"
                + "?fs=0\" frameborder=\"0\">\n"
                + "</iframe>\n";
        return html;
    }

【问题讨论】:

    标签: android html webview youtube fullscreen


    【解决方案1】:

    您需要创建一个新的WebChromeClient,覆盖onShowCustomView(View view, WebChromeClient.CustomViewCallback callback)onHideCustomView()

    请看以下答案:

    https://stackoverflow.com/a/12850816/475472

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-23
      • 1970-01-01
      • 2012-02-17
      • 1970-01-01
      • 2016-08-25
      • 2016-04-26
      • 2015-03-27
      • 1970-01-01
      相关资源
      最近更新 更多