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
Highlighted
Contributor
Posts: 42
Registered: ‎01-05-2011
My Device: Not Specified

MediaPlayer Sample Code - Who's including videos in their app and how?

Hey all,

 

I pretty sure from the reports of this board, that no one has been able to successfully test the QNX MediaPlayer locally and in the simulator, either due to incomplete SDK, docs or lack of simulator support...

 

What code for video player support have people been submitting on the hopes that it'll work on the device? If there's is a sample code there, that is generally agreed upon for the MediaPlayer I'll feel more confident in including videos in my app.

 

Here's my code and the errs I get when I try and run the MediaPlayer in the simulator:

 

Error:

 

 

ArgumentError: Error #2004: One of the parameters is invalid.
at flash.display::Graphics/drawRect()
at qnx.media::VideoDisplay/drawBars()[E:\hudson\workspace\SDK092_deckard_sdk\src\screen\src\qnx\media\VideoDisplay.as:258]
at qnx.media::VideoDisplay/draw()[E:\hudson\workspace\SDK092_deckard_sdk\src\screen\src\qnx\media\VideoDisplay.as:203]
at qnx.ui.core::UIComponent/fireCallLaterMethods()[E:\hudson\workspace\SDK092_deckard_sdk\src\screen\src\qnx\ui\core\UIComponent.as:304]
at qnx.ui.core::UIComponent/callLaterHandler()[E:\hudson\workspace\SDK092_deckard_sdk\src\screen\src\qnx\ui\core\UIComponent.as:296]

 

 

My code:

 

 

override public function init(initData:Object=null):void
{
mediaPlayerDisplay=new VideoDisplay();
mediaPlayerDisplay.width = 640;
mediaPlayerDisplay.height = 480;

mediaPlayer=new MediaPlayer(videoBuildURL,mediaPlayerDisplay);
}


override public function animateIn(duration:Number=0.5, delay:Number=0):void
{
mediaPlayer.addEventListener(MediaPlayerEvent.PREPARE_COMPLETE, onMediaPlayerReady);
mediaPlayer.prepare();
}

private function onMediaPlayerReady(e:MediaPlayerEvent):void
{

if (!mediaPlayerIsReady)
{
mediaPlayerIsReady=true;
TweenLite.to(videoPlayerContainer, .3, {autoAlpha: 1, ease: Quint.easeOut});
}
}

private function onMouseClickHandler(e:MouseEvent):void
{
if (e.target == howToBuildButton)
{
mediaPlayer.url=videoBuildURL;
}
elseif (e.target == howToDesignButton)
{
mediaPlayer.url=videoDesignURL;
}

mediaPlayer.play();
}

override public function resize(width:int, height:int):void
{
DisplayUtils.crop(mediaPlayer.videoDisplay, width - 80, height, true);
mediaPlayer.videoDisplay.x=80;
}

 

Is there something I'm doing wrong here to get this err?

 

On I sidenote I've be using the OSMF video player without issue locally, but if I try to run it in the simulator there's no sound, choppy video and sometimes I have to hit the play function twice for my vids to actually play.....

 

 

Contributor
Posts: 10
Registered: ‎02-24-2011
My Device: Not Specified

Re: MediaPlayer Sample Code - Who's including videos in their app and how?

I've the same issue, any solution?

http://lucamezzalira.com - my blog
http://www.mart3.org - my company
Regular Contributor
Posts: 86
Registered: ‎10-25-2010
My Device: Not Specified

Re: MediaPlayer Sample Code - Who's including videos in their app and how?

Currently the Simulator does not have video codecs so it will not run h264 video. You might be able to run spark or VP6 videos because software decoding. But basically Simulator in its current state is not ready to play videos, and RIM is aware of this.

blog: http://renaun.com
twitter: @renaun