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: 232
Registered: ‎01-30-2011
My Device: Dev Alpha C, Z10 LE
My Carrier: P4
Accepted Solution

How to play a MP3 file with AudioEffectsManager?

Hi,
I want to play a MP3 file, that is in main folder of the app. I want to use a playFile function, but I don't now, what I must as 'clazz'?

I have:
var test:AudioEffectsManager=new AudioEffectsManager();
test.playFile('test.mp3', ?);

I want, that the test.mp3 will be playing in Simulator, because I want to hear it.

Is other method, with who can I hear a MP3 file in Simulator, that is in main folder of app?
All time online Smiley Very Happy
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to play a MP3 file with AudioEffectsManager?

Best to just use the Sound class.

Sound does not work in the 093 simulator but it did in the 092 simulator.

If you can hear it in an AIR app, you're OK.

Developer
Posts: 232
Registered: ‎01-30-2011
My Device: Dev Alpha C, Z10 LE
My Carrier: P4

Re: How to play a MP3 file with AudioEffectsManager?

Can You give me a example, that is working in 0.9.2 simulator? I tested different examples, but nothing work...

(Why it is better to use Sound class, instead of AudioEffectsManager?)
All time online Smiley Very Happy
Highlighted
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to play a MP3 file with AudioEffectsManager?

[ Edited ]

For simple sound, Sound is all you need.

 

 

[Embed(source="assets/sounds/swap.mp3")] private var my_sfx:Class;
...

var snd : Sound = new my_sfx() as Sound;
snd.play();

 

 

Developer
Posts: 232
Registered: ‎01-30-2011
My Device: Dev Alpha C, Z10 LE
My Carrier: P4

Re: How to play a MP3 file with AudioEffectsManager?

Thanks. It work for files, that I have in main app folder?
All time online Smiley Very Happy
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to play a MP3 file with AudioEffectsManager?

Sure, just change the path to the embedded file.  It is common in Flex development is to put your resources like images and sound in a directory called "assets".

Developer
Posts: 232
Registered: ‎01-30-2011
My Device: Dev Alpha C, Z10 LE
My Carrier: P4

Re: How to play a MP3 file with AudioEffectsManager?

Thank You again for Your help.
All time online Smiley Very Happy