replaceScreenshareStream method
Implementation
Future<void> replaceScreenshareStream(WrappedMediaStream existingStream,
WrappedMediaStream replacementStream) async {
final streamIndex = screenshareStreams
.indexWhere((stream) => stream.userId == existingStream.userId);
if (streamIndex == -1) {
throw Exception('Couldn\'t find screenshare stream to replace');
}
screenshareStreams.replaceRange(streamIndex, 1, [replacementStream]);
await existingStream.dispose();
onGroupCallEvent.add(GroupCallEvent.ScreenshareStreamsChanged);
}