removeSubscription method

Future<Result<None>> removeSubscription({
  1. required String userId,
  2. required String sessionId,
  3. required String trackIdPrefix,
  4. required SfuTrackTypeVideo trackType,
  5. RtcVideoDimension? videoDimension,
})

Implementation

Future<Result<None>> removeSubscription({
  required String userId,
  required String sessionId,
  required String trackIdPrefix,
  required SfuTrackTypeVideo trackType,
  RtcVideoDimension? videoDimension,
}) async {
  final result = await _session?.updateSubscription(
        SubscriptionChange.update(
          userId: userId,
          sessionId: sessionId,
          trackIdPrefix: trackIdPrefix,
          trackType: trackType,
        ),
      ) ??
      Result.error('Session is null');

  if (result.isSuccess) {
    _stateManager.participantRemoveSubscription(
      userId: userId,
      sessionId: sessionId,
      trackIdPrefix: trackIdPrefix,
      trackType: trackType,
    );
  }

  return result;
}