Upvote:1

import SwiftUI
import AVKit

struct AudioRoutePickerView: UIViewRepresentable {
    typealias UIViewType = AVRoutePickerView
    
    func makeUIView(context: Context) -> AVRoutePickerView {
        let view = AVRoutePickerView()
        return view
    }
    
    func updateUIView(_ uiView: AVRoutePickerView, context: Context) {
    }
}

More Answer related to the Same Query

Upvote:0

do {
     try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .videoChat, options: [.mixWithOthers, .defaultToSpeaker, .allowBluetooth, .allowAirPlay])
 } catch {
   print(error)
 }

Credit Goes to: stackoverflow.com

Related question with same questions but different answers