I want to stream a live channel from YouTube into my app. See an example of a live channel here: http://www.youtube.com/watch?v=oObdPuriO2w
I don't want to use Intent and the YouTube app in the device. I don't want to depend on it. I read about streaming on Stack Overflow, but I got confused!
- Do I use
WebView
orVideoView
orMediaPlayer
or what? - I read something about RTSP. What is it? Do I need to use it?
- What are the clear ste开发者_高级运维ps of what I need to implement?
To those who might be interested:
I couldn't find a solution to my problem. So, I gave up on that project!
Just follow this code...
WebView video = (WebView)findViewById(R.id.video);
video.getSettings().setJavaScriptEnabled(true);
video.getSettings().setPluginsEnabled(true);
video.loadUrl("http://www.youtube.com/watch?v=oObdPuriO2w");
Note: To stream video on your device, flashplayer must be updated.
About the intents opening, I think that one of the following lines might help avoiding it:
webView.addJavascriptInterface(new JavascriptInterface()
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(...)
{
view.loadUrl(url);
return true;
}
}
...
精彩评论