stop method

  1. @override
Future<void> stop()
override

Stops streaming video

Implementation

@override
Future<void> stop() async {
  try {
    // Stop the camera stream
    localMediaStream?.getTracks().forEach((track) {
      if (track.readyState == 'live') {
        track.stop();
      }
    });
  } catch (e) {
    debugPrint('Failed to stop stream: $e');
  }
  video.srcObject = null;
  localMediaStream = null;
  videoContainer.children = [];
}