阅读量:3
Android 音频通道切换HDMI,蓝牙,喇叭
private void speakerSound() { if (soundOutput.equals("speaker")) { return; } soundOutput = "speaker"; audoManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); audoManager.setMode(AudioManager.STREAM_MUSIC); audoManager.stopBluetoothSco(); audoManager.setBluetoothScoOn(false); audoManager.setSpeakerphoneOn(true); } private void hdmiSound() { if (soundOutput.equals("hdmi")) { return; } soundOutput = "hdmi"; mContext.getSystemService(Context.AUDIO_SERVICE); audoManager.setMode(AudioManager.MODE_IN_COMMUNICATION); audoManager.stopBluetoothSco(); audoManager.setBluetoothScoOn(true); audoManager.setSpeakerphoneOn(false); } private void bluetoothSound() { if (soundOutput.equals("bluetooth")) { return; } soundOutput = "bluetooth"; audoManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); audoManager.setMode(AudioManager.MODE_IN_COMMUNICATION); audoManager.startBluetoothSco(); audoManager.setBluetoothScoOn(true); audoManager.setSpeakerphoneOn(false); }
参考:
https://blog.csdn.net/u010983881/article/details/72420790