video-quickstart-ios: AVPlayer audio does not mix with Room audio.

If you have AVPlayer that plays some video with sound it will become muted once video call established. And after that nothing helps: I’ve tried almost all combinations of AVAudioSession’s AVAudioSessionCategoryOptions, AVAudioSessionSetActiveOptions, tried to setActive:NO and then YES back again before and after call connection. It also doesn’t matter in which position iPhone’s sound switch is. There is only thing that restores sound in player and keeps it going in the call is leaving application (with home button) and open it back.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 9
  • Comments: 36 (18 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @James3432,

Unfortunately, I haven’t had a chance to take another look at this PR since February. I do apologize, and I’ll note that others have also asked if/when it will get merged. I will discuss with the iOS Video team how much effort would be involved in taking the PR to the finish line.

If you know of any way to disable the echo cancellation or auto-gain control altogether, that could also be a solution.

One thing you could try relatively easily, if you haven’t already, would be to drop in ExampleCoreAudioDevice, which does not use echo cancellation. It’s possible that this would fare better along side a vanilla AVPlayer instance then using TVIDefaultAudioDevice, but I have not tried this myself since echo cancellation still needed any time the Client is publishing (recording) audio.

Edit: I see that your use case still requires publishing audio. The problem you will face is the published microphone audio will include some of the AVPlayer audio picked up by the microphone.

Best, Chris

@cipriancaba Thanks for reaching out. I am suspecting, when you start the video streaming, it reconfigures the AVAudioSession which results in no participant audio. We are working on providing better Audio APIs with our Video SDK, however, the problem you are observing can be worked around following way -

Before starting the AVPlayer call resetAudioSession

Once the AVPlayer is started call setupAudioSession

I would recommend you to try AVPlayerExample sample app? It does not play the streaming audio and the remote participant’s audio at the same time, however, it demonstrates usage of audio APIs. Also, it is very easy to play the audio from video streaming audio and remote participant’s audio at the same time by changing some code.

Let me know if you have any question.