enter method

Future<void> enter({
  1. WrappedMediaStream? stream,
})

enter the group call.

Implementation

Future<void> enter({WrappedMediaStream? stream}) async {
  if (!(state == GroupCallState.localCallFeedUninitialized ||
      state == GroupCallState.localCallFeedInitialized)) {
    throw MatrixSDKVoipException('Cannot enter call in the $state state');
  }

  if (state == GroupCallState.localCallFeedUninitialized) {
    await backend.initLocalStream(this, stream: stream);
  }

  await sendMemberStateEvent();

  setState(GroupCallState.entered);

  Logs().v('Entered group call $groupCallId');

  // Set up _participants for the members currently in the call.
  // Other members will be picked up by the RoomState.members event.
  await onMemberStateChanged();

  await backend.setupP2PCallsWithExistingMembers(this);

  voip.currentGroupCID = VoipId(roomId: room.id, callId: groupCallId);

  await voip.delegate.handleNewGroupCall(this);
}