0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS
MIT License
2.92k stars 627 forks source link

Volume without earphones is too low #358

Closed sharadchauhan0504 closed 7 years ago

sharadchauhan0504 commented 7 years ago

Hey, I am using this library to play youtube videos which is working as desired but the only issue is the volume. Its too low but with earphones its better. Do you have any idea how to tackle this problem ? Thanks! @0xced

sharadchauhan0504 commented 7 years ago

Okay I fixed it by overriding the speaker output. Now the default is speaker only. If anyone is facing this silly problem add this before playing video.

let audioSession = AVAudioSession.sharedInstance()

    do {
        try audioSession.overrideOutputAudioPort(AVAudioSessionPortOverride.speaker)
    } catch let error as NSError {
        print("audioSession error: \(error.localizedDescription)")
    }