fix: fixed camera is still active after leaving the group call.

This commit is contained in:
Duan Weiwei 2022-07-01 18:37:37 +00:00 committed by Nicolas Werner
parent f3c1eda97f
commit 425274cb9c
2 changed files with 9 additions and 5 deletions

View File

@ -400,12 +400,15 @@ class CallSession {
} }
Future<void> initWithInvite(CallType type, RTCSessionDescription offer, Future<void> initWithInvite(CallType type, RTCSessionDescription offer,
SDPStreamMetadata? metadata, int lifetime) async { SDPStreamMetadata? metadata, int lifetime, bool isGroupCall) async {
await _preparePeerConnection(); await _preparePeerConnection();
final stream = await _getUserMedia(type); /// only add local stream if it is not a group call.
if (stream != null) { if (!isGroupCall) {
addLocalStream(stream, SDPStreamMetadataPurpose.Usermedia); final stream = await _getUserMedia(type);
if (stream != null) {
addLocalStream(stream, SDPStreamMetadataPurpose.Usermedia);
}
} }
if (metadata != null) { if (metadata != null) {

View File

@ -197,7 +197,8 @@ class VoIP {
content['offer']['type'], content['offer']['type'],
); );
await newCall await newCall
.initWithInvite(callType, offer, sdpStreamMetadata, lifetime) .initWithInvite(
callType, offer, sdpStreamMetadata, lifetime, confId != null)
.then((_) { .then((_) {
// Popup CallingPage for incoming call. // Popup CallingPage for incoming call.
if (!delegate.isBackgroud && confId == null) { if (!delegate.isBackgroud && confId == null) {