03-13-2012 01:29 AM
According to the article Everything You Want To Know About Multimedia, But Don't, the undocumented Player event com.rim.timeUpdate comes with an eventData as a Long object designating the current time index (in millis) of the media being played.
But when I try to get the eventData, I get an instance of an internal class net.rim.device.internal.media.PlayerImpl$Med
Since PlayerImpl$MediaTimeEvent is internal, I cannot process this object. Is there another way to get the current time of the media using the PlayerListener.playerUpdate(Player, String, Object) method?
03-16-2012 02:09 PM
I have to apologize, it *used* to return a Long value, it now returns an internal MediaTimeEvent instance which as you can see you don't have access to. I have updated the documentation which will show up on the public page shortly. Again, I apologize for the error.
The event is sent every second so it can still be used for example to implement a seek-bar or timer, as long as you know the duration of the media. Between that and Player.getMediaTime you should be able to implement all of the functionality that knowing the time in this event would tell you. Specifically, getMediaTime can tell you where you end up after a seek(), so you can set your UI - seek-bar or timer - accordingly.
07-16-2013 10:32 AM
You stated that as long as you know the duration of the media, i am trying to get the duration of an MP4 file from the file header, but no luck so far. All the information i have see is for Java SE, any pointers on how to get this done?
07-17-2013 05:42 PM - edited 07-17-2013 05:42 PM
The Player class getDuration() method can be used. The Player may need to be prefetched (not just realized) to return a valid value but I'm not 100% sure. It's been quite some time since I've been working with BlackBerry OS 7 so you'll have to try it out to check which state it needs to be in
07-17-2013 06:42 PM
thanks for your response, i have tested it out. The problem is that i am fetching an MP4 file from an InputStream of a HttpConnection, simulating a streaming url, the getDuration() returns -1. Any other pointers?
07-25-2013 04:39 PM
Hmmmm... the HttpConnection has a getLength() which returns the length of the data from the HTTP header, that's not terribly useful as it's the length of the data and container not of the media time. Other than parsing the mp4 data to get the length yourself, I can't think of any other options off-hand...
07-29-2013 10:07 AM
i agree, can i get any pointers on parsing the mp4 data, it has been difficult getting proper documentation online. The content length returns -1, which i guess means the web server is not returning the content length.