How to play Youtube videos in Android Video View?

As I can’t find any way to load the rtsp URL in video view (for all devices & android versions), I solved my problem with another work around. I used a webview to embed the youtube player within it, and this method working nicely in all tested devices.

Here is my code:

mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.loadUrl("http://www.youtube.com/embed/" + videoID + "?autoplay=1&vq=small");
mWebView.setWebChromeClient(new WebChromeClient());

Thank you very much for all your help guys.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)