Reputation: 1425
I m trying to play a video in my blackberry default player but my code doesnt work. Here is my code:
HttpConnection connection = (HttpConnection) Connector.open(url+"; deviceside=true",Connector.READ_WRITE, true);
if (connection != null) {
InputStream input = null;
try {
input = connection.openInputStream();
player = Manager.createPlayer(input,"video/3gpp");
player.realize();
//Create a new VideoControl.
videoControl = (VideoControl)player.getControl("VideoControl");
//Initialize the video mode using a Field.
videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
//Set the video control to be visible.
videoControl.setVisible(true);
} catch (IOException e) {
System.out.println("IOException: " + e);
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}//end if
}
}//end if
Thanks and Regards Mintu Nandi
Upvotes: 0
Views: 1729
Reputation: 266
We've got an open source sample on this topic here: https://github.com/blackberry/Samples-for-Java/tree/master/YouTube%20Client
Upvotes: 1
Reputation: 5941
Give this code to invoke the default player. Just you need to pass the youtube URL to it.
Browser.getDefaultSession().displayPage(videoUrl);
Upvotes: 1
Reputation: 45408
It might help to explain more about what exactly is not working. But to start off with here are a few thoughts based on your code:
Upvotes: 0