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

When i change input to BluetoothHFP, player is not working. #167

Open
anjaeyoung26 opened this issue Feb 16, 2022 · 0 comments
Open

When i change input to BluetoothHFP, player is not working. #167

anjaeyoung26 opened this issue Feb 16, 2022 · 0 comments

Comments

@anjaeyoung26
Copy link

let options: AVAudioSession.CategoryOptions = [.mixWithOthers, .allowBluetoothA2DP, .allowBluetooth]
            
try session.setCategory(.playAndRecord, mode: .default, options: options)
try session.setActive(true)
            
if let inputs = session.availableInputs {
    for input in inputs {
        if input.portType == .bluetoothHFP {
            do {
                try session.setPreferredInput(input)
            } catch {
                print(error)
            }
        }
    }
}

I set audio session's input to BluetoothHFP for playing and recording music with Bluetooth mic.
After changing the input, there is no sound even after restarting the player.

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

No branches or pull requests

1 participant