Playing audio

You can play audio on a BlackBerry® device through the BlackBerry® Browser, or by generating a series of discrete tones, by using the class in your BlackBerry device application.

You can use the Player class to open a file that is stored on the BlackBerry device's internal media storage or media card, by specifying a URL, or by specifying a location in your .cod file and using the format: cod:///path. Player provides access to the associated Control classes (for example, VolumeControl) that control the playback and recording functionality (for example, the volume).

You can use the browser to play an audio file by creating a new BrowserSession object and opening the audio file as you would any URI.

You can also create a series of tones to play in your application. For example, you can use these tones as a notification sounds in your application. You can define the frequencies and length of the discrete tones and play them in a sequence.

Was this information helpful? Send us your comments.