youtube-ios-player-helper
youtube-ios-player-helper copied to clipboard
Audio on iOS device is not coming out of external speakers
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.