我在哪里可以保存Android和IOS上的相机插件创建的视频文件?



我在我的飞镖应用程序中使用相机插件。录制视频。

我想在手机上查看这些文件。我可以在哪里保存视频mp4文件以及如何保存?

我用filename.save(路径(保存,我可以看到目录中的文件。我还可以在stopvideo返回的目录中看到xfile。

我可以通过打印文件夹来查看文件但我无法在浏览器中看到+启用隐藏文件。

///init
appDirectory = await getApplicationDocumentsDirectory();
videoDirectory = '${appDirectory.path}';
await Directory(videoDirectory).create(recursive: true);
final String currentTime = DateTime.now().millisecondsSinceEpoch.toString();
filePath = '$videoDirectory/${currentTime}.mp4';
///code    
videoFile = await controller.stopVideoRecording();
print ("XXXX videoFile-"+videoFile.path);
print (Directory("/data/user/0/com.flutter_app_camera1/cache").listSync());
print (Directory("/data/user/0/com.flutter_app_camera1/cache").listSync().length.toString());


await videoFile.saveTo(filePath);
print ("(XXXX filePath-"+filePath);
print (Directory(videoDirectory).listSync());
print (Directory(videoDirectory).listSync().length.toString());

///打印

I/flutter (20330): XXXX videoFile-/data/user/0/com.flutter_app_camera1/cache/REC3520996093112925184.mp4
I/flutter (20330): [File: '/data/user/0/com.flutter_app_camera1/cache/REC3520996093112925184.mp4']
I/flutter (20330): 1
I/flutter (20330): (XXXX filePath-/data/user/0/com.flutter_app_camera1/app_flutter/1618663350463.mp4
I/flutter (20330): [Directory: '/data/user/0/com.flutter_app_camera1/app_flutter/flutter_assets', File: '/data/user/0/com.flutter_app_camera1/app_flutter/res_timestamp-1-1618663045614', File: '/data/user/0/com.flutter_app_camera1/app_flutter/1618663350463.mp4']
I/flutter (20330): 3

如果你想在手机上查看这些文件,你可以使用这个gallery_saver插件将你的视频文件保存在gallery中。

final video = await controller.stopVideoRecording();
await GallerySaver.saveVideo(video.path);

最新更新