pickVideo method
- required ImageSource source,
- CameraDevice preferredCameraDevice = CameraDevice.rear,
- Duration? maxDuration,
Returns a PickedFile
containing the video that was picked.
The source
argument controls where the video comes from. This can
be either ImageSource.camera
or ImageSource.gallery
.
The maxDuration
argument specifies the maximum duration of the captured video. If no maxDuration
is specified,
the maximum duration will be infinite.
Use preferredCameraDevice
to specify the camera to use when the source
is ImageSource.camera
.
The preferredCameraDevice
is ignored when source
is ImageSource.gallery
. It is also ignored if the chosen camera is not supported on the device.
Defaults to CameraDevice.rear
.
In Android, the MainActivity can be destroyed for various reasons. If that happens, the result will be lost in this call. You can then call retrieveLostData when your app relaunches to retrieve the lost data.
If no images were picked, the return value is null.
Implementation
@override
Future<PickedFile?> pickVideo({
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
}) async {
final String? path = await _getVideoPath(
source: source,
maxDuration: maxDuration,
preferredCameraDevice: preferredCameraDevice,
);
return path != null ? PickedFile(path) : null;
}