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

BlackBerry® Storm™

Reply
Developer
keean
Posts: 22
Registered: ‎12-02-2008
My Device: Not Specified

Missing PlayerListener Messages

[ Edited ]

I trying to get the "END_OF_MEDIA" event on a Storm. In the simulator (4.7.0) the event is delivered, but on the device the event never shows up.

 

I am creating the player like this:

 

InputStream in = getClass().getResourceAsStream("/movie.mp4");

player = javax.microedition.media.Manager.createPlayer(in,"video/mp4");

player.addPlayerListener(this);

player.realize();

videoControl = (VideoControl)player.getControl("VideoControl");

videoField=(Field)videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,"net.rim.device.api.ui.Field");

manager.add(videoField);

 

I then have a simple "playerUpdate" method to implement the PlayerListener interface, which dumps the events as strings. On the storm I get:

 

com.rim.loading

com.rim.seekableUpdate

com.rim.mediaLoaded

com.rim.playableStreams

started

 

And that is all. Nothing after started! On the simulator I get the above plus:

 

bufferingStopped

endOfMedia

 

 

What could I be doing wrong?

If I am not doing anything wrong, what are the possible work-arounds for this?

 

Any help much appreciated, as the project deadline is approaching and I have not yet found a solution to this issue.

Message Edited by keean on 12-02-2008 06:12 PM
Message Edited by keean on 12-02-2008 06:13 PM
Message Edited by keean on 12-02-2008 06:14 PM
Message Edited by keean on 12-02-2008 06:14 PM
Please use plain text.
New Developer
Lioni
Posts: 3
Registered: ‎10-16-2008
My Device: Not Specified

Re: Missing PlayerListener Messages

hi.

I have a problem verry much related to yours.

 

i try to play a stream (or file) through javax.microedition.media.Manager.createPlayer, but it doesn't play properly.

the playback stops about 10 sec. before the actual end of the stream(file)

if the stream is shorter than that it doesn't start at all(actually it starts, but stops immediately)

 

on the simulator ecerything is Ok, but on the real device it acts in that weird way.

 

since the same files play normaly on the media player of the device i guess that i do something wrong, on the other hand what could be wrong with these simple rows:

FileConnection file = (FileConnection)Connector.open(FILE_CONN_PREFIX + CURR_DIR + "test.mp3", Connector.READ); player = Manager.createPlayer(file.openInputStream(), "audio/mpeg"); player.start();

(some of the code is removed for clarity)

 

during debug i found the same Keean says - there's a difference between the simulator and the real device. on the device some of the events are never sent and int doesn't play properly

 

my main concern is that it doesn' play, byt i guess that these are different sides of one problem, so any information will be of a help.

 

Keean, did you find "the magic word" for solving this?

or a workarownd?

 

 

Please use plain text.
Developer
keean
Posts: 22
Registered: ‎12-02-2008
My Device: Not Specified

Re: Missing PlayerListener Messages

I mainly used polling to fix the issue. When the user presses the play button it directly checks the state of the player and if not playable does nothing. After starting playback a timer event is schuduled by reading the media length, when this timer event occurs, the state of the player is polled and if still playing, the timer event is rescheduled for a few seconds time. So the media player state gets polled for the last few seconds of playback, and worst case is the simulated EOM event arrives a couple of seconds late (early is not acceptable as it would mean destruction of the player before the user has seen the end of the video).
Please use plain text.
New Developer
Lioni
Posts: 3
Registered: ‎10-16-2008
My Device: Not Specified

Re: Missing PlayerListener Messages

10x for the answer.

 

unfortunately that doesn't help in my case.

 

anyway, thanks. :smileyhappy:

Please use plain text.
Developer
keean
Posts: 22
Registered: ‎12-02-2008
My Device: Not Specified

Re: Missing PlayerListener Messages

Well, I had no problems with short/no playback in either the simulator or the real device... so I would look for a bug here. For example you cannot start the video playback until you have received the media-loaded event and the ui-attached event. If are not waiting for both of these before starting playback then things may not work as expected.
Please use plain text.