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

Adobe AIR Development

Reply
Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

MediaPlayer issues...

[ Edited ]

Has anyone been able to get the MediaPlayer class to actually work?? 

 

My code looks something like:

display = new VideoDisplay();
display.width = 300;
display.height = 200;
addChild(display);

player = new MediaPlayer(FILE_NAME, display);
player.prepare();

 


I get some events, and eventually an error code:

MediaPlayerEvent.PREPARE_COMPLETE
   player.play();

MediaPlayerEvent.INFO_CHANGE

MediaPlayerEvent.INFO_CHANGE

Error: "play:5"


The file name is just a URL of some flv on the web, and I see a black rect where the video should be.

Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: MediaPlayer issues...

[ Edited ]

This code, loading the same video, does work, so it seems to just be an issue with the MediaPlayer API.

 

var myVideo:Video = new Video();
addChild(myVideo);

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);
ns.client = {onMetaData: function(){}}

myVideo.attachNetStream(ns);

 

Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: MediaPlayer issues...

Bump.

 

Would love to hear from QNX here. Is media player API supportted at the moment???

 

Is there a way I can test this on the desktop?? (ie Include the required PPS class)

Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: MediaPlayer issues...

I get the same results.  I also tried with a missing local file (a mistake) and got a "play:2" error.  When I fixed it, even with file available locally, I got the "play:5" error as well.

 

The two INFO_CHANGE events don't look correct either, so that may be a hint the MediaPlayer is not functional yet.  The "what" object in the events is supposed to contain "a property with a value be set to true indicating the change" (whatever that means) and the table in the docs show lots of metadata like "bitrate" and "mediaType".   Mine is just {state: true}, which doesn't look correct or useful, especially given that the same content arrives twice...

 

Any chance we're supposed to use the MediaServiceConnection to request/gain access to the media player engine before we can use MediaPlayer in our app?  Or is that only for launching audio in the system media player (i.e. the thing that shows up when you click on the musical note icon in the system status bar)?


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!