1
我需要在我的Android項目中顯示來自YouTube的視頻列表,當我點擊一個視頻時,它應該以全屏模式啓動。我使用了HTML中其他主題中提到的WebView,但「allowFullScreen」屬性不起作用。iFrame allowFullScreen屬性在Android WebView上不起作用
我試過allowFullScreen,allowFullScreen =「true」,allowFullScreen = allowFullScreen方式。
String frameVideo = "<html><body><iframe width=\"300\" height=\"300\" src=\"https://www.youtube.com/embed/47yJ2XCRLZs\" scrolling=\"no\" frameborder=\"0\" allowFullScreen=\"allowFullScreen\" webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\"></iframe></body></html>";
for(int i=0; i<number_of_videos; i++){
video = new WebView(this);
video.getSettings().setJavaScriptEnabled(true);
video.getSettings().setPluginState(WebSettings.PluginState.ON);
video.loadData(frameVideo, "text/html", "utf-8");
video.setWebChromeClient(new WebChromeClient());
video.setId(i);
video.setPadding(0, 0, 0, 0);
video.setLayoutParams(new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, 900));
root.addView(video);
}
我會避開YouTube API。有什麼建議麼?