06-27-2011 07:03 AM
06-27-2011 07:15 AM
06-28-2011 11:21 AM
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
06-29-2011 05:00 AM
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(inpu tStream,contentType); _player.realize(); //Add listener to catch Player events //_player.addPlayerListener(this); //Get the Player VideoControl _videoControl = (VideoControl) _player.getControl("javax.microedition.media.contr ol.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.getPrefer redWidth(), _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
06-30-2011 03:44 PM
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
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.
07-01-2011 05:38 AM
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!! ![]()
Albert