Closed kyrill-bo closed 10 months ago
Hi you should taking a look at our premade UI here
Just use the state.when to handle the use cases. You don't need to change from video state to recording state. That's all the beauty of using an orchestrator. We do that for you.
get onTap => () {
widget.state.when(
onPhotoMode: (photoState) => photoState.takePhoto(),
onVideoMode: (videoState) => videoState.startRecording(),
onVideoRecordingMode: (videoState) => videoState.stopRecording(),
);
};
@g-apparence ok. i removed the state change ...
onLongPress: () {
setState(() {
videoRecording = true;
});
cameraState.when(
onVideoMode: (state) {
state.startRecording();
},
);
// after 5 stop record
timer = Timer(const Duration(seconds: 5), () {
setState(() {
videoRecording = false;
});
cameraState.when(
onVideoRecordingMode: (state) {
state.stopRecording();
},
);
});
},
onLongPressEnd: (details) {
setState(() {
videoRecording = false;
});
timer!.cancel();
cameraState.when(
onVideoRecordingMode: (p0) {
p0.stopRecording();
},
);
},
how and where do i get the video now as xfile in return?
or is it handled in the save config?
saveConfig: SaveConfig.photoAndVideo(
videoOptions: VideoOptions(
enableAudio: true,
),
videoPathBuilder: (sensors) async {
final Directory? extDir = await getDownloadsDirectory();
final testDir = await Directory('${extDir!.path}/camerawesome')
.create(recursive: true);
final String filePath =
'${testDir.path}/${DateTime.now().millisecondsSinceEpoch}.mp4';
return SingleCaptureRequest(filePath, sensors.first);
},
),
That's it. You can handle that in the saveConfig
After stopRecording nothing happens there is no video stored, what could be the reason? (no, error logs)
@kyrill-bo According to the documentation from path_provider, maybe you should replace getDownloadsDectory with getTemporaryDirectory when using an Android Device. The getDowloadsDirectory not supported for android platform. Check this : https://pub.dev/packages/path_provider
After stopRecording nothing happens there is no video stored, what could be the reason? (no, error logs)
how did u let the user automatically pop from recording? meaning after 5 seconds are you automatically redirecting the user to a video preview page automatically ?
Hello, i need some help. I don't get it, how to start and stop recording Video with own Widgets.
What i mean is: I have a Button, if i hold press on it, i wan't to start recording a video. and if 5 seconds are over or the button is released it should stop it. After that i wan't to return it as a xfile.
how can i do that?
would be very thankful for any kind of help.
here is my code:
this is how i did it for photos: