I have an OPPO A16s phone with Android 13
I added in my manifest file the permissions below:
Here's a code snippet I used:
Future _pickVideo() async {
_isVideoCompressed = false;
final FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.video,
);
finalPlatformFile? file = result?.files.first;
if (file == null) {
return;
}
_filePath = file.path;
setState(() {
_failureMessage = null;
});
final String videoName =
'MyVideo-${DateTime.now().millisecondsSinceEpoch}.mp4';
final Stopwatch stopwatch = Stopwatch()..start();
final Result response = await _lightCompressor.compressVideo(
path: _filePath!,
videoQuality: VideoQuality.medium,
isMinBitrateCheckEnabled: false,
video: Video(videoName: videoName),
android: AndroidConfig(isSharedStorage: true, saveAt: SaveAt.Movies),
ios: IOSConfig(saveInGallery: false),
);
stopwatch.stop();
final Duration duration =
Duration(milliseconds: stopwatch.elapsedMilliseconds);
_duration = duration.inSeconds;
if (response is OnSuccess) {
setState(() {
_desFile = response.destinationPath;
_displayedFile = _desFile;
_isVideoCompressed = true;
});
print("Old path: $_filePath");
print("new path compressed: ${response.destinationPath}");
} else if (response is OnFailure) {
setState(() {
_failureMessage = response.message;
});
} else if (response is OnCancelled) {
print(response.isCancelled);
}
}
When I click on FilePicker, a dialog box appears asking for access to images and videos, as long as I do not accept the permission, the compression works. If only I accept the permission, the compression no longer works.
Under Android 13, I see this on the console output:
Caching from URI: content://media/picker/0/com.android.providers.media.photopicker/media/1000077196
D/FilePickerUtils(4441): File loaded and cached at:/data/user/0/com.lecteur.video/cache/file_picker/1000077196.mp4
D/FilePickerDelegate(4441): [MultiFilePick] File #0 - URI: /picker/0/com.android.providers.media.photopicker/media/1000077196
Under Android 8.1.0, console output:
Caching from URI: content://com.android.providers.media.documents/document/video%3A14815
File loaded and cached at:/data/user/0/com.lecteur.video/cache/file_picker/VID-20231209-WA0085.mp4
D/FilePickerDelegate(18106): File path:[com.mr.flutter.plugin.filepicker.FileInfo@c947eb8]
I have an OPPO A16s phone with Android 13
I added in my manifest file the permissions below:
Here's a code snippet I used:
Future _pickVideo() async {
_isVideoCompressed = false;
}
When I click on FilePicker, a dialog box appears asking for access to images and videos, as long as I do not accept the permission, the compression works. If only I accept the permission, the compression no longer works.
Under Android 13, I see this on the console output:
Caching from URI: content://media/picker/0/com.android.providers.media.photopicker/media/1000077196
D/FilePickerUtils(4441): File loaded and cached at:/data/user/0/com.lecteur.video/cache/file_picker/1000077196.mp4
D/FilePickerDelegate(4441): [MultiFilePick] File #0 - URI: /picker/0/com.android.providers.media.photopicker/media/1000077196
Under Android 8.1.0, console output:
Caching from URI: content://com.android.providers.media.documents/document/video%3A14815
File loaded and cached at:/data/user/0/com.lecteur.video/cache/file_picker/VID-20231209-WA0085.mp4
D/FilePickerDelegate(18106): File path:[com.mr.flutter.plugin.filepicker.FileInfo@c947eb8]