ISBX / apprtc-ios

A native iOS video chat app based on WebRTC
BSD 3-Clause "New" or "Revised" License
1.35k stars 413 forks source link

there's no sound in the headphones when I open the video #112

Closed kwzcoder closed 6 years ago

kwzcoder commented 6 years ago

I plug in the headphones before I open the video, and there's no sound in the headphones, and the sound comes out of the speaker

kwzcoder commented 6 years ago

thank you for your answer sincerely, i think that i made a mistake. it works when i change my code like this: - (void)enableSpeaker { [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord mode:AVAudioSessionModeVideoChat options:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil]; _isSpeakerEnabled = YES; }