BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 01-30-2009, 09:07 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Audio File not playing :(

Please Login to Remove!

Hi,

I am using the following code to play a mp4 file. But i always get an exception:
AUDIOMANAGER: IOException. I dont understand y this error has been coming. I am using BB Curve 8300, OS: 4.5. The audio file is bundled with the cod.

Please help me.

Code:
public class AudioAlert {
    private static Player playerWav ;
    private static boolean isWavSupported ;
    
    public void playBeep(){

        if(isWavSupported){
            try{
                playerWav.realize();
                playerWav.prefetch();/
                playerWav.start();         
            }catch(MediaException ex){
                System.out.println("Exception: " + ex.toString());
            }
        }
    }
    
    public AudioAlert() {
        String types[] = Manager.getSupportedContentTypes(null);
        for (int cnt = types.length - 1; cnt >= 0; --cnt) {
            if (types[cnt].equals("audio/mp4")) {
                try {
                    Class clazz = Class.forName("com.rim.samples.device.myapp.myappmain");
                    InputStream is = clazz.getResourceAsStream("/Alarm.mp4");
                    playerWav = Manager.createPlayer(is, "audio/mp4");
                    isWavSupported = true ;
                    break ;
                } catch (MediaException ex) {
                    System.out.println("Exception: " + ex.toString());
                }catch(Exception e){
                    System.out.println("Exception: " + e.toString());
                }            
            }
        }
    }
}
or suggest by which i can play the audio file in my app.
__________________
Thanks
Meenal
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

47uF 12V Electrolytic Capacitor IEC - NOS QTY 5
$4.49
47uF 12V Electrolytic Capacitor IEC - NOS QTY 5  pictureSangamo Capacitor .01uF 400VDC CP05A1-EE103K - NOS Qty 2
$7.99
Sangamo Capacitor .01uF 400VDC CP05A1-EE103K - NOS Qty 2  picture50uF 16V Electrolytic Capacitor IEC - NOS QTY 5
$4.49
50uF 16V Electrolytic Capacitor IEC - NOS QTY 5  picture10uF 16V Electrolytic Capacitor IEC - NOS QTY 5
$4.49
10uF 16V Electrolytic Capacitor IEC - NOS QTY 5  pictureNew MESR-100 V2 AutoRanging In Circuit ESR Capacitor Tester Meter 0.001 to 100R
$50.49
New MESR-100 V2 AutoRanging In Circuit ESR Capacitor Tester Meter 0.001 to 100R picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.