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
Posts: 229
Registered: ‎11-21-2009
My Device: Not Specified

createPlayer(xx) param to get getAudioPath() for phone calls...

 

 Can someone tell me which parameter I should use for the "player" to get the Audio Path for phone calls  - as you can see I am using "capture://audio".  Is this the correct parameter?

 

 

	try {
		javax.microedition.media.Player p = javax.microedition.media.Manager.createPlayer("capture://audio");
		AudioPathControl c=(AudioPathControl)p.getControl("net.rim.device.api.media.control.AudioPathControl");
		int audioPath=c.getAudioPath();
		for(int i=0;i<audioMasks.length;i++) if(audioPath==audioMasks[i]) return audioPaths[i];
		return "Unknown";
	}

 

 

 

	public static String[] audioPaths={"Bluetooth","Bluetooth_A2DP","Handset","Speaker","Headset",
		                               "Headset/HandsFree"};
    public static int[] audioMasks={AudioPathControl.AUDIO_PATH_BLUETOOTH,AudioPathControl.AUDIO_PATH_BLUETOOTH_A2DP,
		                            AudioPathControl.AUDIO_PATH_HANDSET,AudioPathControl.AUDIO_PATH_HANDSFREE,
		                            AudioPathControl.AUDIO_PATH_HEADSET,AudioPathControl.AUDIO_PATH_HEADSET_HANDSFREE};

 

 

Developer
Posts: 484
Registered: ‎07-17-2008
My Device: Not Specified

Re: createPlayer(xx) param to get getAudioPath() for phone calls...

What you are trying to do is not possible, AFAIK.

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: createPlayer(xx) param to get getAudioPath() for phone calls...

Are you trying to capture a phone call or just what audio path it is using?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 229
Registered: ‎11-21-2009
My Device: Not Specified

Re: createPlayer(xx) param to get getAudioPath() for phone calls...

I just want to know if someone is talking handset, headset, or bluetooth...that's all

New Contributor
Posts: 2
Registered: ‎05-05-2010
My Device: Blackberry Strorm
My Carrier: Verizon

Re: createPlayer(xx) param to get getAudioPath() for phone calls...

I am facing a similar problem. Any solutions ?