react-native - 如果已连接,如何将音频路由切换到蓝牙耳机
问题描述
如何在通话中切换音频路由(从扬声器到 ios 中的蓝牙耳机)或将默认连接设置为蓝牙耳机(如果已连接),我使用的是react-native-incall-manager包。
我曾尝试调用 InCallManager.chooseAudioRoute('BLUETOOTH') 但它不起作用。这是我的代码
if (this.props.isBluetoothConnected) {
InCallManager.chooseAudioRoute('BLUETOOTH');
} else {
if (this.props.isEarPhonePlugged) {
InCallManager.setForceSpeakerphoneOn(false);
InCallManager.chooseAudioRoute('EARPIECE')
} else {
InCallManager.start({media: 'video'});
InCallManager.chooseAudioRoute('SPEAKER_PHONE')
InCallManager.setForceSpeakerphoneOn(true);
}
}
解决方案
推荐阅读
- vim - 仅在“有效”时才加载插件
- image - 从 Flutter 中的 Uint8List 数据更改图像大小
- android - Facebook Android 应用警告 - URL 合规性
- docker - docker挂载卷的奇怪分配所有者
- python - Python在2个脚本之间使用变量进行多处理
- css - 谁能指导我在这段代码中创建另一个菜单?
- c++ - 从 txt 文件中读取由字符分隔的元素
- python - 在 selenium 中实现复杂的 unicode emoji 字符
- ios - SwiftUI — Color.yellow 在 iOS 设备上呈现为棕色(但在模拟器中呈现为黄色)
- android - Android 生产 Google 和 Facebook 签名不起作用