stopMediaStream function
Implementation
Future<void> stopMediaStream(MediaStream? stream) async {
if (stream != null) {
for (final track in stream.getTracks()) {
try {
await track.stop();
} catch (e, s) {
Logs().e('[VOIP] stopping track ${track.id} failed', e, s);
}
}
try {
await stream.dispose();
} catch (e, s) {
Logs().e('[VOIP] disposing stream ${stream.id} failed', e, s);
}
}
}