如何区分AirPods和连接耳机?

问题描述 投票:0回答:1

我有一个需要检查搜索的设备是否是AirPods设备。我不知道如何开始。希望得到您的帮助。非常感谢您的帮助

 AVAudioSessionRouteDescription *currentRount = [AVAudioSession sharedInstance].currentRoute;
    AVAudioSessionPortDescription *outputPort = currentRount.outputs[0];
    if ([outputPort.portType isEqualToString:AVAudioSessionPortBluetoothA2DP]) {

    } else {

    }
ios bluetooth bluetooth-lowenergy airpods
1个回答
0
投票

我对iOS的音频框架没什么经验,尤其是蓝牙模块。但我看了一些书。你可以从这个开始。

如何检测iOS系统中连接的是HFP还是A2DP?

还有BT协议的列表(好读)。

http:/monkeycanz.comhrf_faqwhat-are-蓝牙-a2dp-avrcp-hfp-hsp-protocols。


然后回答你的问题,这里是苹果的文档,用于 AVAudioSessionPort

https:/developer.apple.comdocumentationavfoundationavaudiosessionport?language=objc。

从那里你可以看到该结构的常量,如。

AVAudioSessionPortHeadphones - 有线耳机的输出

AVAudioSessionPortHeadsetMic - 有线耳机的内置麦克风。

所以就有了。我觉得,如果你有这些常量(也请检查其他常量),你就有你要找的东西了。

希望对你有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.