How record video in flutter_webrtc?

99 views Asked by At

I am using flutter_webrtc package to view the live video streaming from a cctv camera in mobile. There is a requirement for a feature in which the user can record the live video in the app. So, how to implement this feature using flutter_webrtc? Or is there any other methods available?

1

There are 1 answers

2
Jaimin Raval On

You can try this code it is mentioned in web_rtc example

void _captureFrame() async {
    final stream =
        await RTCFactoryNative.instance.navigator.mediaDevices.getUserMedia({
      'audio': false, // if you want audio pass true
      'video': true,
    });

    final track = stream.getVideoTracks().first;
    final buffer = await track.captureFrame();

    stream.getTracks().forEach((track) => track.stop());

    setState(() {
      _data = buffer.asUint8List();
    });
  }