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
Regular Contributor
Posts: 62
Registered: ‎04-06-2011
My Device: Blackberry developer
My Carrier: Blackberry developer

Re: VideoControl = null

Ok, i will try to convert the avi file into mp4 file and i try...
So i don't know what i am doing wrong...
Thanks for you great help,
Albert
Regular Contributor
Posts: 62
Registered: ‎04-06-2011
My Device: Blackberry developer
My Carrier: Blackberry developer

Re: VideoControl = null

nop... not working.
I tried with mp4 and nothing. Still a black field and it doesn't play...
Don't know what else can i do...
Retired
Retired
Posts: 150
Registered: ‎10-19-2010
My Device: Not Specified
My Carrier: Rogers

Re: VideoControl = null

Hi!

 

Silly question, but are you calling Player.start in your code (it's not in your original code example)?  Failing that is there an exception or an error from your player listener?  Failing that, can you repost the updated code you are using?

 

Thanks

Regular Contributor
Posts: 62
Registered: ‎04-06-2011
My Device: Blackberry developer
My Carrier: Blackberry developer

Re: VideoControl = null

jaja, yes, i did player.start()... This is my actual code:

 

InputStream inputStream = null;
HttpConnection conn;
String apendix = ConnectionUtilities.getConnectionMethodParameter();
try {
	conn = (HttpConnection)Connector.open(url+apendix);
	inputStream = conn.openInputStream();
	
	_player = javax.microedition.media.Manager.createPlayer(inputStream,contentType);
	_player.realize();
	
	//Add listener to catch Player events 
	//_player.addPlayerListener(this);
	
	//Get the Player VideoControl 
	_videoControl = (VideoControl) _player.getControl("javax.microedition.media.control.VideoControl");
	
	if(_videoControl==null){
		throw new IOException("VideoControl=null");
	}
	
	//Initialize video display mode 
	_videoField = (Field) _videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,"net.rim.device.api.ui.Field");
			
	//Set the video display size to 360x 280
	try {
	 _videoControl.setDisplaySize(_videoField.getPreferredWidth(), _videoField.getPreferredHeight());
	} catch (MediaException e) {
		Dialog.inform("Error SetDisplaySize");
	}    

 //Set video control to visible _videoControl.setVisible(true);
add(_videoField); } catch (IOException e) { Dialog.inform(e.getMessage()); } catch (MediaException e) { Dialog.inform(e.getMessage()); } try { _player.start(); } catch (MediaException e) { return false; }

I apreciate your help, I really don't know how to make it works! Thanks,

 

Albert

Retired
Retired
Posts: 150
Registered: ‎10-19-2010
My Device: Not Specified
My Carrier: Rogers

Re: VideoControl = null

Try not using _videoField.getPrefferedWidth/Height, instead use explicit values or if your goal is to make the field the same size as the video then use VideoControl.getSourceWidth/Height.

 

AVI is supported, both 'video/avi' or 'video/x-msvideo' are valid content-types you can pass in.  Can you get the video lcoally and try loading it from an SDCard rather than a remote connection?  Use Manager.createPlayer("file:///SDCard/path/to/video.avi");

 

This is a remote connection, so uncomment the line that isn't adding your player listener and make sure you add one.  Then check your player listener to see what events you are getting.  Are there errors or buffering messages?  Also change the 'return false' to display what the MediaException is, since this return is hiding that information.

Highlighted
Regular Contributor
Posts: 62
Registered: ‎04-06-2011
My Device: Blackberry developer
My Carrier: Blackberry developer

Re: VideoControl = null

if i make "_player.addPlayerListener(this);", how can i control the events of the player in the same class?

Which kind of events i must control and how i do it??

 

Thanks for your help.

I will try and i tell you!! Smiley Happy

 

Albert