Welcome!

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

Java Development

Reply
Developer
joek
Posts: 38
Registered: ‎12-06-2008
My Device: 9530

AudioPathControl not routing audio correctly

I'm trying to play some media through the handsfree speaker, but it isn't routing correctly. I'm using the latest 4.7 beta JDE.  Here is my code:

 

_player = javax.microedition.media.Manager.createPlayer(_audioLocation);
_player.addPlayerListener(this);
_player.realize();
_player.prefetch();

Control[] c = _player.getControls();
for(int i=c.length-1; i>=0; --i) {
if(c[i] instanceof AudioPathControl) {
_audioPathControl = (AudioPathControl)c[i];
_audioPathControl.setAudioPath(AudioPathControl.AUDIO_PATH_HANDSFREE);
}
}

_player.start();

 

On my Storm, the audio ends up outputting through the headset (apparently, even when one isn't plugged in). I installed on a pearl, and the audio plays through the handset.  If I specify AudioPathControl.AUDIO_PATH_HANDSET, it routes correctly (that is, to the handset). I even added some code that calls getAudioPath and it appears to show that the audio path was set correctly. Am I missing something here? Is there something that's preventing me from outputting to the speakerphone?  Is there any way to find out where the simulator is supposedly outputting to?

 

Thanks,

Joe

 

Please use plain text.
New Developer
Massif
Posts: 6
Registered: ‎12-12-2008
My Device: Not Specified

Re: AudioPathControl not routing audio correctly

I'm having a similar problem with the Storm. I'm trying to play MP3 audio over the speaker or the headset (if it's plugged in). However, no sound plays over the speaker. If I plug in the headset, the sound plays. If I unplug the headset while a sound is playing, it continues to play over the speaker. This is without having touched the AudioPathControl at all. I tried setting the Audio path to AudioPathControl.AUDIO_PATH_HEADSET_HANDSFREE but that didn't work either.

 

Any suggestions?

Please use plain text.
Developer
joek
Posts: 38
Registered: ‎12-06-2008
My Device: 9530

Re: AudioPathControl not routing audio correctly

The same discussion is going on over here now: http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=11963.  In short, it appears to be a fairly major bug in the 4.7.0.75 software. No one has yet discovered a workaround, nor has RIM responded.

Please use plain text.
New Developer
Massif
Posts: 6
Registered: ‎12-12-2008
My Device: Not Specified

Re: AudioPathControl not routing audio correctly

Thanks for the quick response. I'll check that thread out.
Please use plain text.
New Developer
rt29
Posts: 1
Registered: ‎04-21-2009
My Device: Not Specified

Re: AudioPathControl not routing audio correctly

try setting the AudioPath after starting the player. It might help. 
Please use plain text.