Android 音频通道切换HDMI,蓝牙,喇叭

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

相关推荐

  1. Android 音频通道切换HDMI,,喇叭

    2024-07-17 11:08:01       27 阅读
  2. Android 14 主从模式切换

    2024-07-17 11:08:01       33 阅读
  3. Android 实战——音乐播放进度(二十)

    2024-07-17 11:08:01       30 阅读
  4. android 开关设置

    2024-07-17 11:08:01       54 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-17 11:08:01       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-17 11:08:01       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-17 11:08:01       58 阅读
  4. Python语言-面向对象

    2024-07-17 11:08:01       69 阅读

热门阅读

  1. C#拆分单页PDF

    2024-07-17 11:08:01       25 阅读
  2. TCP/IP、UDP、HTTP 协议介绍比较和总结

    2024-07-17 11:08:01       22 阅读
  3. js | 原型链

    2024-07-17 11:08:01       24 阅读
  4. baomidou @DS注解

    2024-07-17 11:08:01       23 阅读
  5. arkts中状态管理

    2024-07-17 11:08:01       26 阅读
  6. mac如何查看cpu和显卡温度

    2024-07-17 11:08:01       27 阅读
  7. 关于HBase、Phoenix、Flume、Maxwell 和 Flink

    2024-07-17 11:08:01       25 阅读
  8. 银河麒麟如何部署QtMqtt(入门案例教程)

    2024-07-17 11:08:01       25 阅读
  9. Android中ContentProvider学习记录

    2024-07-17 11:08:01       23 阅读
  10. IPython 宏魔法:%macro 命令的高效使用指南

    2024-07-17 11:08:01       25 阅读
  11. 五、python列表

    2024-07-17 11:08:01       27 阅读