A
A
Alexander2014-07-29 01:51:11
Android
Alexander, 2014-07-29 01:51:11

Why can't video(iframe html5 youtube) play on android 2.3.3?

Welcome all. There is the following code:

mWebView = (WebView) findViewById(R.id.youtube_player);

            WebSettings settings = mWebView.getSettings();
            settings.setJavaScriptEnabled(true);
            settings.setPluginState(WebSettings.PluginState.ON);
            mWebView.setWebChromeClient(new WebChromeClient());
            mWebView.setWebViewClient(new WebViewClient());
         
            html += "<html><body style=\"margin:0px\">";
            html += "<iframe id=\"ytplayer\" type=\"text/html\" style=\"border: 0; width: 100%; height: 100%;  margin:0px\" src=\"http://www.youtube.com/embed/"+ linkVideo +"\" frameborder=\"0\" allowfullscreen></iframe>";
            html += "</body></html>";

            mWebView.loadDataWithBaseURL("http://www.youtube.com",html, "text/html","UTF-8", null);

Android:hardwareAccelerated="true" is also written in AndroidManifest.xml
The problem is that on android 2.3.3 after pressing the play button I get only a black screen. Here are the actual screenshots of this:
64df740217134c68b5bc6f9eb8eaeb0f.png2ffca11a84b4429791bcdb43843e0750.png
Android 2.3.3 supports html5, so why is the video not playing? What is wrong in my code? Maybe there are other ways to solve this issue? YOUTUBE API is not offered as it is not suitable due to videoSyndicated .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question