1

I've been trying to reproduce the audio of a video on the Bluetooth speakers and the audio gets distorted ever with the volume being quite low. The video is reproduced with AVPlayer and the sounds are correct when it plays on the device on iOS 13 Following some of the comments I've seen during my research I added the code:

do {
    try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [.mixWithOthers, .allowBluetooth, .allowBluetoothA2DP,.defaultToSpeaker])
    try AVAudioSession.sharedInstance().setActive(true)
            
} catch(let error) {
    print("*** \(error) ***")
    Crashlytics.crashlytics().record(error: error)
} 

I tried with the previous code in a different place, before the initialization of AVPlayer, after the initialization or in the AppDelegate with the same result.

Some related questions:

How to connect the audio to bluetooth when playing using AVPlayer

iOS Swift - Poor audio quality when using Bluetooth external speaker

AVAudioSession setCategory Swift 4.2 iOS 12 - Play Sound on Silent

Maciej Gad
  • 1,701
  • 16
  • 21
Fran Ruano
  • 143
  • 1
  • 7

0 Answers0