youtube-ios-player-helper icon indicating copy to clipboard operation
youtube-ios-player-helper copied to clipboard

Audio on iOS device is not coming out of external speakers

Open sumanc opened this issue 5 years ago • 0 comments

I am developing a native iOS app and one of the features is playing YouTube videos. Everything works fine except the audio does not come out of speakers. It always comes out of earpiece.

I tried the following code;

NSError *error = nil;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
                                 withOptions: AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionDefaultToSpeaker
                                       error: &error];
if (error != nil) {
    NSLog(@"Problem setting AVAudioSession to mix with others");
}

but didn't help.

sumanc avatar Jun 19 '19 01:06 sumanc