BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-07-2010, 06:43 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 9700
PIN: N/A
Carrier: Engineer
Posts: 22
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Video Player

Please Login to Remove!

Hi, i have written the code for playing video file in bb, but when i run the program excepetion occurs like.

( javax.microedition.media.MediaException ) although i have caught the exception.

My code is:

package VideoProject;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import javax.microedition.media.Manager;
import javax.microedition.media.Player;
import java.io.IOException;
import javax.microedition.media.control.VideoControl;
import net.rim.device.api.ui.DrawStyle;
import javax.microedition.media.control.*;

class TestVideo extends MainScreen
{



TestVideo()
{


try{
Player player;
VideoControl videoControl;
player = Manager.createPlayer("/res/BlackBerry/videos/vid.3gp");
player.realize();
videoControl = (VideoControl)player.getControl("VideoControl");
videoControl.initDisplayMode(VideoControl.USE_DIRE CT_VIDEO,this);
GUIControl gc;
if ((gc = (GUIControl)player.getControl("GUIControl"))!=null )
{
add((Field)gc.initDisplayMode(GUIControl.USE_GUI_P RIMITIVE,null));
}//if

videoControl.setDisplayLocation(15,200);
videoControl.setDisplaySize(200, 200);
videoControl.setVisible(true);
player.start();

}catch (Exception e){
System.out.println("Exception in video playing..."+e);
}
}//constructor


}//class



package VideoProject;

import net.rim.device.api.ui.UiApplication;


class VideoApp extends UiApplication
{
public static void main(String args[])
{

VideoApp app = new VideoApp();
app.enterEventDispatcher();
}

VideoApp()
{

TestVideo mainScreen=new TestVideo();
pushScreen(mainScreen);
}
}



can u explain why this occurs. if u have any other example then plz write the code in reply.

Thanks in advance.

Regards:

Zulfiqar

Last edited by zulfiqarchandio : 04-07-2010 at 06:47 AM.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.