Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 8
Registered: ‎05-15-2009
My Device: Not Specified

media player can't open video file

Hi,

I use a BB Curve 8520 and I want to use a media player.

Therefore I have the following code (here it's a snippet):

 

try
{
//Create a new Player pointing to the video file.
//This can use any valid URL.
String filePath = "file:///store/samples/videos/MuteMath.mp4";

FileConnection con = (FileConnection) Connector.open(filePath);
if(con.exists())
{
InputStream is = con.openInputStream();
player = Manager.createPlayer(is, "video/mp4");
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 (Exception ex)
{
System.out.println(ex.toString());
}

 When I press the space bar the player should start with player.start(). But the player doesn't start although the mp4 is there.

Any ideas?

 

Thanks.

 

 

BlackBerry Development Advisor
Posts: 15,809
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: media player can't open video file

Third party applications are not able to access the sample content bundled with the BlackBerry device software.  Try a different mp4 file that you have copied to your BlackBerry Smartphone.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.