I am using image_picker: ^0.6.7+22, when I use the library to select a video from gallery only photos appear. There is no way to select a video from my gallery.
final video = await picker.getVideo(source: ImageSource.gallery);
I am using image_picker: ^0.6.7+22, when I use the library to select a video from gallery only photos appear. There is no way to select a video from my gallery.
final video = await picker.getVideo(source: ImageSource.gallery);
In order to display and play a video we need to depend on third party because Flutter doesn’t support video playback by default So for displaying videos You have to use video_player plugin Add this dependency in pubspec.yaml video_player: ^0.11.1+2
this is a function for playing a video in Flutter:
_pickVideo() async {
PickedFile pickedFile = await picker.getVideo(source: ImageSource.gallery);
_video = File(pickedFile.path);
_videoPlayerController = VideoPlayerController.file(_video)..initialize().then((_) {
setState(() { });
_videoPlayerController.play();
});
}