Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing video during a call in iOS #174

Closed
Romick2005 opened this issue Nov 16, 2021 · 0 comments
Closed

Playing video during a call in iOS #174

Romick2005 opened this issue Nov 16, 2021 · 0 comments

Comments

@Romick2005
Copy link
Contributor

We need need to play video during a webrtc call. To play a video we use react-native-video.

User story: When user press a button to play video, current webrtc video stream goes away and remote mp4 video file is played. After video finish webrtc connection should be restored. But the problem here that after restoring (show hide local and remotes streams) we loose microphone audio.
That scenario works perfectly well on Android , but not for iOS.
We discovered that when video is played react-native-video changes AVAudioSession sharedInstance category and mode:
category: AVAudioSessionCategoryPlayback, audioMode = AVAudioSessionModeDefault,
when internal values are:
category: AVAudioSessionCategoryPlayAndRecord, audioMode = AVAudioSessionModeVideoChat,
So after playing video we need to restore webrtc audio session.

What would be the best way to fix this?

  1. On video end, invoke InCallManager.start that would have following checks: if _audioSessionInitialized then check if _audioSession.category != _incallAudioCategory then set audioSessionSetCategory: _incallAudioCategory and if audioSession.mode != _incallAudioMode then set audioSessionSetMode:_incallAudioMode
  2. On video end, invoke InCallManager.setForceSpeakerphoneOn where on updateAudioRoute just set category if it is different than _incallAudioCategory
  3. Create separate IncallManager method reInitAudioSession where explicitly set category and mode (_incallAudioCategory and _incallAudioMode), but that will also require some empty RCT_EXPORT_METHOD Android implementation.
Romick2005 added a commit to Romick2005/react-native-incall-manager that referenced this issue Nov 16, 2021
…rphoneOn as setting audio mode would have no effect on invalid audio category.
zxcpoiu added a commit that referenced this issue Dec 3, 2021
#174 Fix audio session restore for setForceSpeakerphoneOn method
zxcpoiu added a commit that referenced this issue May 26, 2022
ffdb9b3 fix: make bluetooth and proximity manager runs on the main thread  ( zxcpoiu 2022-05-26 07:48:50 +0800)
87fda16 android: support check bluetooth permission for api 31  ( zxcpoiu 2022-05-01 00:31:25 +0800)
5500e34 Updated readme to better reflect current status.  ( lahsuk 2021-12-14 16:22:00 +0545)
bbad44c Add android get wired headset.  ( lahsuk 2021-12-14 16:17:56 +0545)
73dfce9 android: refine OnAudioFocusChangeListener  ( zxcpoiu 2021-12-09 12:22:58 +0800)
82778ca android: expose request/abandon audio focus  ( zxcpoiu 2021-12-09 12:15:34 +0800)
f29b1f9 android: AudioFocus api compatible  ( zxcpoiu 2021-12-09 02:50:05 +0800)
7a48b8b typo correction: changed remote to remove (#180)  ( javatutorials2016 2021-12-07 15:02:48 -0500)
43ac15b android: use new api of AudioFocus and do not using compat  ( zxcpoiu 2021-12-08 04:01:25 +0800)
5f05bbd Expose proximity functions (#179)  ( lahsuk 2021-12-03 13:03:33 +0545)
f9b2c97 #174 Fix audio category restore for setForceSpeakerphoneOn as setting audio mode would have no effect on invalid audio category.  ( Roman Melnyk 2021-11-16 15:51:23 +0200)
54bd8d4 android: deprecate setAudioStreamType in favor of AudioAttributes  ( zxcpoiu 2021-11-10 17:55:52 +0800)
8cdac83 android: fix startRingtone use handler inside thread without looper  ( zxcpoiu 2021-11-10 02:12:58 +0800)
c0fa1f5 android: bump android build/compile version to match latest RN  ( zxcpoiu 2021-11-10 00:20:05 +0800)
b32ae30 misc: change npm url in package.json  ( zxcpoiu 2021-11-10 00:16:59 +0800)
a6e7672 remove permission related codes  ( zxcpoiu 2021-01-23 03:43:05 +0800)
cce2a34 fix: Sometimes startRingtone() would throw `java.lang.UnsupportedOperationException`  ( Ricardo Corrie 2021-09-27 10:55:44 -0400)
8eb2b45 On android, there is a significant performance bottleneck when calling `startRingtone` and `stopRingtone`.  ( Ricardo Corrie 2021-08-27 22:29:39 -0400)
784fe80 fix: Xcode 12 compatibility  ( nvojnovic 2021-03-02 11:02:37 +0100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant