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
Contributor
SoftyBoy
Posts: 10
Registered: ‎04-05-2011
My Device: Curve 9330
My Carrier: Sprint
Accepted Solution

MediaPlayer Error

I am trying to get MediaPlayer work. Using the example code from API MediaControl and replace the video file with one of my own and change the blackberry-tablet.xml to include <action>play_audio<\audio>.

 

When I try to play the file I am getting a Error message of

"Error #2044: Unhandled error:. text=MediaPlayer: Error during -(play)"

 

does this error message mean I have forget to set up media player?

 

 

 

Please use plain text.
Developer
gerardkcohen
Posts: 48
Registered: ‎10-06-2009
My Device: Not Specified

Re: MediaPlayer Error

First, make sure you have the following added to your blackberry-tablet.xml:

 

<action>access_shared</action>

 

Then, when pointing to your local file, use .nativePath instead of .url

 

If everything is setup properly, then the video should play.

 

 

Please use plain text.
Contributor
SoftyBoy
Posts: 10
Registered: ‎04-05-2011
My Device: Curve 9330
My Carrier: Sprint

Re: MediaPlayer Error

Thanks for the help.


The MediaPlayer still does not work. I have try the code example on the api and I am getting the same problem.

Please use plain text.
Developer
gerardkcohen
Posts: 48
Registered: ‎10-06-2009
My Device: Not Specified

Re: MediaPlayer Error

Are you sure the file exists, or that your pointing to right path?

 

Can you post some code?

Please use plain text.
Contributor
SoftyBoy
Posts: 10
Registered: ‎04-05-2011
My Device: Curve 9330
My Carrier: Sprint

Re: MediaPlayer Error

 

The code below is from the MediaPlayer Api. I have just replace the file name with my own which is located in the applicationDirectory

private function initializePlayer():void
		{
			_myVD = new VideoDisplay;
			_myVD.setPosition(1024/2 - 800/2, 600/2 - 480/2);
			_myVD.setSize(800, 480);
			_myVD.backgroundColor = 0x000000;
			addChild(_myVD);
			
			_myPlayer = new MediaPlayer();
			_myPlayer.addEventListener(MediaPlayerEvent.INFO_CHANGE, infoChange);
			
			var file:File = File.applicationDirectory.resolvePath("file.flv");
			trace(file.nativePath + " " +file.exists);
			_myPlayer.url = file.nativePath;            
			_myPlayer.videoDisplay = _myVD;
			
		}
Please use plain text.
Developer
gerardkcohen
Posts: 48
Registered: ‎10-06-2009
My Device: Not Specified

Re: MediaPlayer Error

I dont think the QNX media player will play FLV files. Try it with an MP4.

 

If you need to play an FLV, then I think your only option is the use the Flex videoPlayer.

Please use plain text.
Contributor
SoftyBoy
Posts: 10
Registered: ‎04-05-2011
My Device: Curve 9330
My Carrier: Sprint

Re: MediaPlayer Error

I tested the a mp4 file and I wasn't able to get it working on the simulator. Then I tested it on the device I just got the sound.

Please use plain text.
Developer
gerardkcohen
Posts: 48
Registered: ‎10-06-2009
My Device: Not Specified

Re: MediaPlayer Error

[ Edited ]

You need to set the allowOverlay to of the videoDisplay to false.

 

Do this:

 

private function initializePlayer():void
		{
			//_myVD = new VideoDisplay; << Dont Do this
                        _myVD = new VideoDisplay(false); // Set the allowOverlay to false
			_myVD.setPosition(1024/2 - 800/2, 600/2 - 480/2);
			_myVD.setSize(800, 480);
			_myVD.backgroundColor = 0x000000;
			addChild(_myVD);
			
			_myPlayer = new MediaPlayer();
			_myPlayer.addEventListener(MediaPlayerEvent.INFO_CHANGE, infoChange);
			
			var file:File = File.applicationDirectory.resolvePath("file.flv");
			trace(file.nativePath + " " +file.exists);
			_myPlayer.url = file.nativePath;            
			_myPlayer.videoDisplay = _myVD;
			
		}

 

 

I dont know why, it seems like a bug to me. That should give you the video.

 

Please use plain text.
New Developer
Hasufel
Posts: 18
Registered: ‎06-03-2011
My Device: Playbook
My Carrier: none

Re: MediaPlayer Error

Hi there. I reported the bug two weeks ago: https://www.blackberry.com/jira/browse/TABLET-232

It has finally been assigned yesterday, but still in triage.

The reason why you only have the sound is that one cannot have flash overlay on - so set flash overlay off for your video to appear (which supress the advantage of having an overlay...).

Extract:

"The MediaPlayerSample described in the Examples of http://www.blackberry.com/developers/docs/airapi/1.0.0/qnx/media/MediaPlayer.html does not work, unless the VideoDisplay is set to overlay = false. This is not documented, and besides, what is the use of having the overlay method set to true by default if one cannot display video and has to set the overlay set to false? We would really need the possibility of adding an overlay to a video playing with the VideoDisplay native qnx.media.VideoDisplay."

 

Please VOTE people for the issue to be taken in account.

We could really take advantage of having playbook natively running video without impacting flash performance.

Thank you!

Please use plain text.
Trusted Contributor
vijaytabhatt
Posts: 146
Registered: ‎03-22-2010
My Device: Not Specified

Re: MediaPlayer Error

i am also using the same sample code but i cannot hear any sound ,also set overlay to false.

i am playing video given in sample code.

Please use plain text.