5
votes

The problem is that I can load YouTube site, and navigate trough videos,

but when I click to play a video nothing happens.

Video just get orange flash like it is selected,

but doesn't start loading or playing.

I am using Android 2.2.

the methods that I am using in web View are:

webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setPluginState(PluginState.ON); webView.getSettings().setPluginsEnabled(true);

enter image description here

any help is highly appreciated,

Thanks

2
Are you trying to connect via http or rtsp? - Dr Glass
Why are using this method? it would be far better if its a single video to upload it somewhere and have it stream in a VideoView. Or if there are more then 1 video - use Intent to launch the youtube app - since pretty much every android comes with this app pre-installed. - Yalla T.

2 Answers

0
votes

You can checkout the HTML5 video player source code from here

0
votes

As I found that the YouTube is working in default browser used.. this work around.. to get it working..

if (url.contains("youtube")) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} else {
    webView.loadUrl(url);
}