iFrame allowFullScreen attribute doesn't work on Android WebView

Viewed 1769

I need to show a list of videos from YouTube in my Android project, when I click on a video it should start in fullscreen mode. I used a WebView as suggested in other topics with the iFrame from html but the "allowFullScreen" attribute doesn't work.

I tried allowFullScreen, allowFullScreen = "true", allowFullScreen = allowFullScreen ways.

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);
    }

I would avoid the YouTube APIs. Any suggestions?

1 Answers
Related