3

I'm currently developing an app using WebRTC for live-streaming. However, when the connection is made, WebRTC per default is interpreted as a call by the iOS device. This implies a lot of audio-related unintuitive behaviours for my users. (Sound can't go to 0, not the same volume than classic videos, I can't hide the call volume HUD when user changes the volume...)

So I'm looking for a native way to "route" (or change) the category of the audio from "call" audio to a standard "media" audio.

Is there any way to do this?

Brad
  • 159,648
  • 54
  • 349
  • 530
Lawallful
  • 31
  • 4
  • Is this a web-based app, or native? – Brad Sep 26 '21 at 21:40
  • Web-based but as I didn't find a way to do it through react-native, I started looking at native implementations. – Lawallful Sep 27 '21 at 00:27
  • I was doing some testing tonight on a similar issue. The difference for me is less about where the video comes from, and more the fact that the web page is using `getUserMedia()`. Do you get this problem when simply playing video? – Brad Sep 27 '21 at 03:34
  • No, playing simple videos works perfectly. I've done some progress though. Looks like AVAudioSession category is the responsible. You can't set it directly because WebRTC will override it but using the `RTCAudioSessionConfiguration` it is possible. When I set it to `AVAudioSessionCategoryPlayAndRecord`, it works but in "call" mode. If I set it to `AVAudioSessionCategoryPlayback`, I get the "media" mode, video works but with no sound. What happens is that WebRTC requires both mic and speaker to work, even in spectator mode when mic is of no use. I'm currently looking for a way around this. – Lawallful Sep 27 '21 at 11:41
  • Some people actually encountered a similar issue illustrated by the device requiring the mic permissions even when the mic isn't used, I think it's related : https://bugs.chromium.org/p/webrtc/issues/detail?id=5873 I suppose that once you use `getUserMedia()`, you start setting up the config requiring both mic and speaker and the problem occurs. – Lawallful Sep 27 '21 at 11:43
  • For the web, as long as you don't make a call to `getUserMedia()` it should be fine, yes? You can playback tracks from a peer connection without calling `getUserMedia()`. – Brad Sep 27 '21 at 12:20
  • After verification I'm not using `getUserMedia()` on the spectator side and still getting this issue... – Lawallful Sep 27 '21 at 14:07
  • Do you have some test code we can use to reproduce the issue? – Brad Sep 27 '21 at 20:32

0 Answers0