WebRTCDemo: clean the error message due to API clean up and add ability to route the audio through all three outputs, headset/earpiece/loudspeaker
BUG=3366 TEST=Manual Test R=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17559004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6207 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
49a6a27bf0
commit
1a79bb8d30
@ -22,6 +22,7 @@ import android.content.IntentFilter;
|
|||||||
import android.hardware.Camera.CameraInfo;
|
import android.hardware.Camera.CameraInfo;
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
|
import android.media.AudioManager;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.OrientationEventListener;
|
import android.view.OrientationEventListener;
|
||||||
@ -194,6 +195,10 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
orientationListener.enable();
|
orientationListener.enable();
|
||||||
|
// Set audio mode to communication
|
||||||
|
AudioManager audioManager =
|
||||||
|
((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
|
||||||
|
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||||
// Listen to headset being plugged in/out.
|
// Listen to headset being plugged in/out.
|
||||||
IntentFilter receiverFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
|
IntentFilter receiverFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
|
||||||
headsetListener = new BroadcastReceiver() {
|
headsetListener = new BroadcastReceiver() {
|
||||||
@ -423,8 +428,9 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
|||||||
|
|
||||||
private void updateAudioOutput() {
|
private void updateAudioOutput() {
|
||||||
boolean useSpeaker = !headsetPluggedIn && speakerEnabled;
|
boolean useSpeaker = !headsetPluggedIn && speakerEnabled;
|
||||||
check(voe.setLoudspeakerStatus(useSpeaker) == 0,
|
AudioManager audioManager =
|
||||||
"Failed updating loudspeaker");
|
((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
|
||||||
|
audioManager.setSpeakerphoneOn(useSpeaker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startViE() {
|
public void startViE() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user