terminate method

Future<void> terminate({
  1. bool emitStateEvent = true,
})

terminate group call.

Implementation

Future<void> terminate({bool emitStateEvent = true}) async {
  final existingStateEvent =
      room.getState(EventTypes.GroupCallPrefix, groupCallId);
  await dispose();
  participants = [];
  voip.groupCalls.remove(room.id);
  voip.groupCalls.remove(groupCallId);
  if (emitStateEvent) {
    await client.setRoomStateWithKey(
        room.id, EventTypes.GroupCallPrefix, groupCallId, {
      ...existingStateEvent!.content,
      'm.terminated': GroupCallTerminationReason.CallEnded,
    });
    Logs().d('[VOIP] Group call $groupCallId was killed');
  }
  await voip.delegate.handleGroupCallEnded(this);
  setState(GroupCallState.Ended);
}