Playing r.raw thru earpiece instead of speaker?

All your problems with Audio, Video and Images.

Playing r.raw thru earpiece instead of speaker?

Postby androidiot » Thu Dec 08, 2011 5:41 pm

I'm trying to play a R.raw file thru my earpiece instead of the main phone speaker on my app but everyhting I throw at it isn't working. With my current code... it just plays very light static through the earpiece and not the R.raw I want.

Here is my code below and I set it in the manifest:
Code: Select all
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>


Code: Select all
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
            am.setSpeakerphoneOn(false);
        am.setMode(AudioManager.MODE_IN_CALL);

        MediaPlayer tellSecret = MediaPlayer.create(this, R.raw.secret);
    tellSecret.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
    tellSecret.start();


Am I missing something here?
androidiot
Freshman
Freshman
 
Posts: 3
Joined: Wed Nov 23, 2011 7:25 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 17 guests