Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeviceInfo.isHeadphonesConnected() doesn't detect all ways headphones can be connected on iOS #1634

Open
eedeebee opened this issue Apr 24, 2024 · 1 comment

Comments

@eedeebee
Copy link

eedeebee commented Apr 24, 2024

]

Summary

The current code for iOS, I think, doesn't cover some cases for wired headphones

So I have some BT headphones that I can also connect via an cable and adapter to a lightning port; I believe if you check for line-in you will pick up some more use cases ,but these of course, aren't guaranteed to be headphones per se. Below is a code snippet that you could use to adjust the existing code for this if you wanted. - thank you Apple for the confusion.

if ([[port portType] isEqualToString:AVAudioSessionPortHeadphones] ||
            [[port portType] isEqualToString:AVAudioSessionPortAudioUSB] ||   // strictly speaking not headphones, but might be
            [[port portType] isEqualToString:AVAudioSessionPortBluetoothA2DP] ||
            [[port portType] isEqualToString:AVAudioSessionPortBluetoothHFP] ||
            [[port portType] isEqualToString:AVAudioSessionPortBluetoothLE]) {
            return YES;
        }
    }
return NO;
@mikehardy
Copy link
Collaborator

Hi there! If you proposed a PR we could merge it. Note the code you mention needs a modification is now duplicated, so there's two spots to add the different bluetooth profiles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants