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

BlackBerry® World™ Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

problems with Playing audio files Simultaneously


 Hi all,

            when am trying to play two audio files it is giving errors. the details are as follows...


    am working with BB strom,  4.7.0 version. for my application i need to play audio files at a time. 1 file as background through out the app and the other at the random positions. when i tried to play them separately the audio is  playing ensuring that the code is correct and the file formats are also supportable.

                  am using .wav file for background file and .mp3 file for the foreground file. on a particular button click i need to invoke the mp3 file where i need to hear audio of the both  files. 


                   the following is the code snippet please suggest me teh solution how to fix these two.

/**** code for the audio playing ***/ public class Audio extends Thread { private Class clazz; private InputStream is; private Player player; String audiofile; private int fileType; public Audio(String path, int type) { audiofile = path; fileType = type; } public void run() { //this sample demonstrates playing an MP3 file that has been //added as a resource to the project try { //retrieve the MP3 file clazz = getClass(); //create an instance of the player from the InputStream is = clazz.getResourceAsStream(audiofile); // 1-- mpeg, 2-- wav audio files if(fileType == 1) player = javax.microedition.media.Manager.createPlayer(is, "audio/mpeg"); else if(fileType ==2) player = javax.microedition.media.Manager.createPlayer(is, "audio/x-wav"); player.realize(); player.prefetch();

if(count == 1){ player.setLoopCount(-1);

} // count used to make the background to play infinetly player.start(); } catch (Exception ex) { System.out.println(ex.getMessage()); } } }



LoadingScreen() { at = new Audio("/neon1.wav",2); at.start(); }// calling the background file. similarly under the button click but a different file



Thanks and Regards,