tryRemoveStopedStreams method

Future<void> tryRemoveStopedStreams()

Implementation

Future<void> tryRemoveStopedStreams() async {
  final removedStreams = <String, WrappedMediaStream>{};
  streams.forEach((stream) {
    if (stream.stopped) {
      removedStreams[stream.stream!.id] = stream;
    }
  });
  streams
      .removeWhere((stream) => removedStreams.containsKey(stream.stream!.id));
  for (final element in removedStreams.entries) {
    await _removeStream(element.value.stream!);
  }
}