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

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

bash 复制代码
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

相关推荐
怣疯knight13 小时前
Windows不安装 Android Studio如何打包安卓软件
android·windows·android studio
ke_csdn13 小时前
从Java演变到Kotlin下的jet pack
android
wenzhangli714 小时前
在低代码设计中践行 Harness Engineering
android·低代码·rxjava
xingpanvip14 小时前
星盘接口开发文档:组合三限盘接口指南
android·开发语言·前端·python·php·lua
TechMix15 小时前
【fkw学习笔记】Android 13 AOSP 源码添加系统预置应用实战指南
android·笔记·学习
云起SAAS15 小时前
私域直播系统UniApp源码 多商户商城+直播带货 微信小程序+H5+安卓iOS
android·微信小程序·uni-app·私域直播系统
空中海15 小时前
01. 安卓逆向基础、环境搭建与授权
android
星河耀银海16 小时前
JAVA 泛型与通配符:从原理到实战应用
android·java·服务器
Ada大侦探16 小时前
新手小白学习数据分析01----数据分析师???& 数据分析思维学习
android·学习·数据分析
大学生小郑16 小时前
CMOS 传感器堆叠结构
图像处理·学习·音视频·视频