2012-07-20 58 views
3

我正在使用the guide displayed over here將視頻嵌入到WebView控制器中。在WebView中嵌入YouTube視頻不尊重全屏設置

web視圖是其具有Theme.Dialog

嵌入視頻顯示與縮略圖首先在活動主題的活動內。我使用fs=0來禁用全屏選項。

按下播放按鈕後,在HTML5模式下的視頻負載(我認爲),那麼它不尊重fullsceen設置我設置。

如何禁用在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; 
    } 

回答

2

你需要創建一個新的WebChromeClient,覆蓋onShowCustomView(View view, WebChromeClient.CustomViewCallback callback)onHideCustomView()

請參見下面的回答:

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