startTimer method
void
startTimer()
Implementation
void startTimer() {
recordingStart = 0;
const oneSec = const Duration(seconds: 1);
timer = new Timer.periodic(
oneSec,
(Timer timer) {
if (recordingStart == recordingEnd) {
setState(() async {
timer.cancel();
if (controller!.value.isRecordingVideo) {
setState(() {
isRecording = false;
timer.cancel();
});
XFile videoFile = await controller!.stopVideoRecording();
SellonRouter.push(
context,
VideoPreviewFileNew(
timeEnd: widget.timeEnd,
isFromCamera: true,
videoFile: File(videoFile.path),
)); //a;nd there is more in this XFile object
}
});
} else {
setState(() {
recordingStart++;
});
}
},
);
}