sendMemberStateEvent method

Future<void> sendMemberStateEvent()

Implementation

Future<void> sendMemberStateEvent() async {
  final deviceId = client.deviceID;
  await updateMemberCallState(
    IGroupCallRoomMemberCallState.fromJson(
      {
        'm.call_id': groupCallId,
        'm.devices': [
          {
            'device_id': deviceId,
            'session_id': client.groupCallSessionId,
            'expires_ts': DateTime.now()
                .add(expireTsBumpDuration)
                .millisecondsSinceEpoch,
            'feeds': getLocalStreams()
                .map((feed) => ({
                      'purpose': feed.purpose,
                    }))
                .toList(),
            // TODO: Add data channels
          },
        ],
        // TODO 'm.foci'
      },
    ),
  );

  if (resendMemberStateEventTimer != null) {
    resendMemberStateEventTimer!.cancel();
  }
  resendMemberStateEventTimer =
      Timer.periodic(updateExpireTsTimerDuration, ((timer) async {
    Logs().d('updating member event with timer');
    return await sendMemberStateEvent();
  }));
}