I need to play a youtube video from my bb application. Does anyone know how to do that? Can I have a youtube video player directly inside my app or can I at least have a link to open youtube video in the browser?
+1
A:
What you want to do is get the rtsp
streaming URL for the video. When I browse to YouTube on a BlackBerry with the native browser, it serves a page with links to this format. If you know exactly which video to play at build-time, great. If it's going to be picked by your users, you'll have to figure that out.
Then, with that URL, you can create a Player like this:
Player p = Manager.createPlayer("rtsp://SOME_YOUTUBE_VIDEO_ID_HERE/video.3gp");
p.realize();
VideoControl vc = (VideoControl)p.getControl("javax.microedition.media.control.VideoControl");
Field f = (Field)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field" );
The Field f can be added to your screen. And you can start the video with
p.start();
spacemanaki
2010-10-18 14:57:42