如何解决从图库中选择图像或视频后,Flutter App 重新启动我正在使用 image_picker 0.6.7+22
这些是我用于挑选图像和视频的功能。我正在使用 image_picker 0.6.7+22。在模拟器上它工作正常但在真实设备上运行它在选择图像一段时间后重新启动应用程序。在我的应用程序中,我从图库中选择了三张图片和 1 个视频。 如果需要任何其他详细信息,请告诉我。请帮我解决这个问题。如果你需要完整的代码,我可以分享我的项目链接。
_pickVideoFromGallery() async {
PickedFile video = await ImagePicker().getVideo(
source: ImageSource.gallery,);
_video = File(video.path);
videopath = video.path;
_videoPlayerController = VideoPlayerController.file(_video)
..initialize().then((_) {
setState(() {
_videoPlayerController.play();
});
});
}
_pickVideoFromCamera() async {
PickedFile video = await ImagePicker().getVideo(
source: ImageSource.camera,maxDuration: Duration(seconds: 15));
_video = File(video.path);
videopath = video.path;
_videoPlayerController = VideoPlayerController.file(_video)
..initialize().then((_) {
setState(() {
_videoPlayerController.play();
});
});
}
String validateName(String value) {
if (value == null) {
return "This field can't be empty";
}
return null;
}
final picker = ImagePicker();
Future pickImageone() async {
final pickedFile = await picker.getImage(source: ImageSource.gallery);
setState(() {
_imagepathone = File(pickedFile.path);
});
}
Future pickImagetwo() async {
final pickedFile = await picker.getImage(source: ImageSource.gallery);
setState(() {
_imagepathtwo = File(pickedFile.path);
});
}
Future pickImagethree() async {
final pickedFile = await picker.getImage(source: ImageSource.gallery);
setState(() {
_imagepaththree = File(pickedFile.path);
});
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。