iOS-开始录制时,蓝牙设备会认为I';我在打电话
我有一个录音应用程序。我遇到了一个问题,当我打开我的应用程序,手机与蓝牙设备配对时,只要我开始录音,蓝牙设备就会认为我在打电话。它发出传出呼叫的声音,并在屏幕上显示“on call”(总是谈论BT设备),但当然没有实际呼叫 以下是我当前初始化会话的方式:iOS-开始录制时,蓝牙设备会认为I';我在打电话,ios,bluetooth,avaudiorecorder,avaudiosession,Ios,Bluetooth,Avaudiorecorder,Avaudiosession,我有一个录音应用程序。我遇到了一个问题,当我打开我的应用程序,手机与蓝牙设备配对时,只要我开始录音,蓝牙设备就会认为我在打电话。它发出传出呼叫的声音,并在屏幕上显示“on call”(总是谈论BT设备),但当然没有实际呼叫 以下是我当前初始化会话的方式: [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideNone
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideNone
error:nil];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionMixWithOthers |
AVAudioSessionCategoryOptionAllowBluetooth
error: nil];
我在两个不同的蓝牙设备上试用过,同样的结果也会发生。双方都试图建立一个电话
在查看蓝牙日志后,我发现了一些关于它在做什么的线索:
12:24:07.185 A2DPClient.cpp:390 StopStreaming A2DP Notice Stopping A2DP audio streaming
12:24:07.186 A2DPClient.cpp:415 StopStreaming A2DP Notice Sending 'A2DP audio disconnected' event for device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:24:07.201 HandsfreeAudioPlugIn.cpp:971 audioDataAvailable Handsfree Notice HandsfreeAudioPlugIn:: Audio available event for 00:19:B5:FE:05:9B, reason: 2
12:24:07.203 HandsfreeAudioPlugIn.cpp:971 audioDataAvailable Handsfree Notice HandsfreeAudioPlugIn:: Audio available event for 00:19:B5:FE:05:9B, reason: 4
12:24:07.203 HandsfreeAudioPlugIn.cpp:971 audioDataAvailable Handsfree Notice HandsfreeAudioPlugIn:: Audio available event for 00:19:B5:FE:05:9B, reason: 1
12:24:07.203 HandsfreeGateway.cpp:699 createVisualVoicemai Handsfree Notice Setting up virtual call
12:24:07.205 AudioSendThread.cpp:91 run Audio Notice AudioSendThread stopping
12:24:07.207 HandsfreeGateway.cpp:1540 initiateScoConnectio Handsfree Notice Initiating SCO connection with delay of 20 milliseconds
12:24:07.207 HandsfreeGateway.cpp:3179 handleUpdateCallStat Handsfree Notice Updating call status for call(s): [ [#1: Outgoing to +XXXXXXXXXXXXX "My Number" (voicemail)] ]
12:24:07.207 HandsfreeGateway.cpp:1523 delayScoConnection Handsfree Notice Delaying SCO connection by 20 milliseconds
12:24:07.208 HandsfreeGateway.cpp:3183 handleUpdateCallStat Handsfree Notice callPresent: no, callState: 1, callSetup: outgoing, heldStatus: none, heldChanged: no, visualVoicemail: yes
12:24:07.208 HandsfreeGateway.cpp:2871 tellEveryOneAboutVVM Handsfree Notice Sending call setup "outgoing" to device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:24:07.208 HandsfreeGateway.cpp:2877 tellEveryOneAboutVVM Handsfree Notice Sending call status "call active" to device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:24:07.208 HandsfreeGateway.cpp:2760 operator() Handsfree Notice Sending call setup "none" to device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:24:07.229 HandsfreeGateway.cpp:1626 internalConnectAudio Handsfree Notice Making outgoing audio connection to device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:24:07.457 HandsfreeGateway.cpp:1161 audioEvent Handsfree Notice Received audio connected event for device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:24:07.471 A2DPClient.cpp:1384 SuspendCfm A2DP Notice Successfully suspended stream to device 00:19:B5:FE:05:9B "VW_RADIO_55"
12:25:36.959 LeObserver.cpp:904 scanTimer Discovery Notice Session "wirelessproxd-central-35-1" is now at scan level 3
12:25:59.599 HandsfreeAudioPlugIn.cpp:1050 audioPauseNotificati Handsfree Notice HandsfreeGateway::audioPauseNotification
12:25:59.599 HandsfreeGateway.cpp:726 deleteVisualVoicemai Handsfree Notice Cleaning up virtual call
12:25:59.599 HandsfreeGateway.cpp:1567 internalDisconnectAu Handsfree Notice Disconnecting audio from device 00:19:B5:FE:05:9B "VW_RADIO_55"
设置虚拟呼叫是什么???我在代码中做的唯一一件事就是
[self.audioRecorder record];
self.audioRecorder
当然是AVAudioRecorder
的一个例子
如何防止出现这种情况?每当您想开始录制且不允许蓝牙时,请更改
音频会话
选项:
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideNone
error:nil];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error: nil];
[self.audioRecorder record];
录制完成后,在AVAudioRecorder
实例的代理调用中:
-(void)录音机IDfinishRecording:(AVAudioRecorder*)录音机成功:(BOOL)标志
设置您的
AVAudioSession
选项以允许蓝牙avaudiosessioncategoryooptionalLowBluetooth
,这样AVAudioSession
就不会假定录音输入应作为来自所连接BT设备的语音呼叫进行处理 但是如果有蓝牙设备,这会不会断开我当前播放的蓝牙设备?是的。。。这并不理想,但您也可以存储当前播放的位置,并在设置类别后继续播放。是的,这对我不起作用。这是一个卡拉OK应用程序,所以我需要在录制时继续播放。无论如何,谢谢你的建议。