stopVideoRecording method

  1. @override
Future<CameraMacOSFile?> stopVideoRecording()
override

Call this method to stop video recording and collect the video data.

Implementation

@override
Future<CameraMacOSFile?> stopVideoRecording() async {
  try {
    final Map<String, dynamic>? result =
        await methodChannel.invokeMapMethod<String, dynamic>('stopRecording');
    if (result == null) {
      throw FlutterError("Invalid result");
    }
    if (result["error"] != null) {
      throw result["error"];
    } else {
      isRecording = false;
      return CameraMacOSFile(
        bytes: result["videoData"] as Uint8List?,
        url: result["url"] as String?,
      );
    }
  } catch (e) {
    isRecording = false;
    return Future.error(e);
  }
}