Search code examples
blackberry-playbookblackberry-qnx

Trying to play sound on blackberry playbook


I'm trying to play a simple beep sound in my playbook application when a countdown expires. I manage to get the countdown to work correctly and but I can't get my sound to work.

This is how i'm playing my sound.

[Embed(source="sounds/beep.mp3")] private var CustomSound:Class;
...
...
...
var sound : Sound = new CustomSound() as Sound;
sound.play();

Solution

  • If it is only a beep sound, you could do the following:

    // play some sound
    var fx:AudioEffectsManager = new AudioEffectsManager();
    fx.play(AudioEffect.ALARM_BATTERY);
    

    just replace the

    AudioEffect.ALARM_BATTERY
    

    by the sound of your choice.