hmhv/YoutubePlayer-in-WKWebView

Change WKYTPlayerView output to speaker in Swift?

ArunVicky001 opened this issue · 0 comments

I am currently facing some issues with my application, I am trying to stream youtube videos in iOS 16.1 using WKYTPlayerView.
here the player audio is not output to the speaker in Swift.

but previously it was working well.

I have tried the below code but it's not working

let audioSession = AVAudioSession.sharedInstance()

    do {
        try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.voiceChat, options: AVAudioSession.CategoryOptions.mixWithOthers)
        try audioSession.overrideOutputAudioPort(.none)
        try audioSession.setActive(true)
    } catch {
        debugPrint(error.localizedDescription)
    }

can anyone please suggest something?