Add support for audio device selection in AppRTCDemo.
Summary: - Creates a list of available (possible to select) audio devices. - Automatically selects (routes audio) the "best/default" audio device. - If possible, starts a proximity sensor that will switch between headset earpiece and speaker phone based on how close the a person's ear the mobile device is held. TBR=glaznev BUG=4103,4109 Review URL: https://webrtc-codereview.appspot.com/31239004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7978 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -203,7 +203,14 @@ public class AppRTCDemoActivity extends Activity
|
||||
|
||||
// Create and audio manager that will take care of audio routing,
|
||||
// audio modes, audio device enumeration etc.
|
||||
audioManager = AppRTCAudioManager.create(this);
|
||||
audioManager = AppRTCAudioManager.create(this, new Runnable() {
|
||||
// This method will be called each time the audio state (number and
|
||||
// type of devices) has been changed.
|
||||
public void run() {
|
||||
onAudioManagerChangedState();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
final Intent intent = getIntent();
|
||||
Uri url = intent.getData();
|
||||
@@ -294,6 +301,11 @@ public class AppRTCDemoActivity extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
private void onAudioManagerChangedState() {
|
||||
// TODO(henrika): disable video if AppRTCAudioManager.AudioDevice.EARPIECE
|
||||
// is active.
|
||||
}
|
||||
|
||||
// Disconnect from remote resources, dispose of local resources, and exit.
|
||||
private void disconnect() {
|
||||
if (appRtcClient != null) {
|
||||
@@ -595,5 +607,4 @@ public class AppRTCDemoActivity extends Activity
|
||||
disconnectWithErrorMessage(description);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user