enter method
enter the group call.
Implementation
Future<void> enter({WrappedMediaStream? stream}) async {
if (!(state == GroupCallState.LocalCallFeedUninitialized ||
state == GroupCallState.LocalCallFeedInitialized)) {
throw Exception('Cannot enter call in the $state state');
}
if (state == GroupCallState.LocalCallFeedUninitialized) {
await initLocalStream(stream: stream);
}
await _addParticipant(
(await room.requestUser(client.userID!, ignoreErrors: true))!);
await sendMemberStateEvent();
activeSpeaker = null;
setState(GroupCallState.Entered);
Logs().v('Entered group call $groupCallId');
_callSubscription = voip.onIncomingCall.stream.listen(onIncomingCall);
for (final call in calls) {
await onIncomingCall(call);
}
// Set up participants for the members currently in the room.
// Other members will be picked up by the RoomState.members event.
final memberStateEvents = await getAllMemberStateEvents();
for (final memberState in memberStateEvents) {
await onMemberStateChanged(memberState);
}
onActiveSpeakerLoop();
voip.currentGroupCID = groupCallId;
await voip.delegate.handleNewGroupCall(this);
}