5

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

Prashant Mishra
  • 627
  • 5
  • 18
  • Are you trying to connect via http or rtsp? – Dr Glass Sep 27 '12 at 07:10
  • 1
    have you checked this one http://stackoverflow.com/questions/10861285/webview-youtube-videos-not-playing – Arpit Garg Sep 27 '12 at 07:37
  • 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. Sep 27 '12 at 08:13

2 Answers2

0

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);
}
Ziem
  • 6,579
  • 8
  • 53
  • 86
Prashant Mishra
  • 627
  • 5
  • 18
0

You can checkout the HTML5 video player source code from here

Ravi K. Sharma
  • 545
  • 8
  • 15