I recently started flutter and in my project I have to record a video with timer. I am getting this error when I click on stop button to stop the video recording. I tried to display the path and I got the path
I/flutter (19037): Video recorded to /data/user/0/app.package/cache/REC8929992591965700575.mp4
I/flutter (19037): Error: INVALID_PATH
I/flutter (19037): Error Message: The platform "TargetPlatform.android" did not return a path while reporting success. The platform should always return a valid path or report an error.
I/flutter (21723): Video recorded to /data/user/0/app.package/cache/REC4634449859696013797.mp4
E/flutter (21723): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: CameraException(INVALID_PATH, The platform "TargetPlatform.android" did not return a path while reporting success. The platform should always return a valid path or report an error.)
using this plugin:
camera: ^0.9.4+5
video_player: ^2.2.10
my code :
void _onStopButtonPressed() {
if (cd.isRunning) { //timer
cd.cancel();
}
_stopVideoRecording().then((file) {
if (mounted) setState(() {});
if (file != null) {
videoPath = file; //getting the file
}
});
}
Future<XFile> _stopVideoRecording() async {
if (controller == null || !controller.value.isRecordingVideo) {
return null;
}
try {
return controller.stopVideoRecording();
} on CameraException catch (e) {
_showCameraException(e);
return null;
}
}