Closed yanghun0070 closed 5 months ago
@maitrungduc1410
https://github.com/facebook/react-native/issues/36714
I think you can change the code below.
export async function showEditor(
videoPath: string,
config: EditorConfig = {}
): Promise<void> {
const { maxDuration, saveToPhoto = true } = config;
const outputPath = await VideoTrim.showEditor(videoPath, {
saveToPhoto,
maxDuration,
});
if (Platform.OS === 'android' && saveToPhoto) {
if (Platform.Version < 33) {
await VideoTrim.saveVideo(outputPath);
} else {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE!,
{
title: 'Video Trimmer Photos Access Required',
message: 'Grant access to your Photos to write output Video',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
await VideoTrim.saveVideo(outputPath);
} else {
VideoTrim.hideDialog();
throw new Error('Photos Library permission denied');
}
} catch (err) {
throw err;
}
}
}
}
Thanks for letting me know,
Yeah from sdk 33 we don't need to request for storage permission, will push a fix soon
please upgrade to 1.0.7, I fixed this, from Android >= 33, it won't request for this permission
After updating compileSdk and targetSdk to 33, a problem occurred where WRITE_EXTERNAL_STORAGE permission was not requested when installing the app.