cordova-plugin-video-editor
cordova-plugin-video-editor copied to clipboard
Can't access or make Movies directory
In my app, I download a video from my server, and save it using the FileTransfer plugin. The location where it's saved goes via the cordova File plugin.
This is the path of the video: var path = this.file.dataDirectory + 'path/to/downloads/'+this.locatie+'.mp4';
VideoEditor.transcodeVideo( function (result) { console.log('videoTranscodeSuccess, result: ' + result); }, function (err) { console.log('videoTranscodeError, err: ' + err); }, { fileUri: path, outputFileName: 'test.mp4', saveToLibrary: true, progress: function (info) { console.log('transcodeVideo progress callback, info: ' + info); } } );
gives me: "Can't access or make Movies directory".
I'm testing this on a real Android device. It has nothing to to with the file being saved, because I can play the video using a different plugin.
In my Android Manifest, I've added <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_VIDEO" />
just to be sure.
Any news on this? I've got the same issue.
If you are using Android API 26 (Oreo 8.x), then it is a permission issue. You must ask the permission at run-time.
The cordova-plugin-android-permissions did the trick for me:
by requesting the PERMISSIONS.WRITE_EXTERNAL_STORAGE permission.
I am having this issue.
Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: 100
I'm currently getting this error. I have used @killerchip suggestion which is returning with permission to WRITE_EXTERNAL_STORAGE.
Here is my script requesting access:
document.addEventListener('deviceready', e => {
cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.WRITE_EXTERNAL_STORAGE, checkStatus => {
if (!checkStatus.hasPermission) {
cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.WRITE_EXTERNAL_STORAGE, requestStatus => {
if (!requestStatus.hasPermission) {
Cookies.set('write_external_storage', false, {expires: 365});
} else {
Cookies.set('write_external_storage', true, {expires: 365});
}
}, (error) => {
Cookies.set('write_external_storage', false, {expires: 365});
});
} else {
Cookies.set('write_external_storage', true, {expires: 365});
}
});
});
and the code I am using to try and create a video thumbnail:
if (Cookies.get('write_external_storage') !== false) {
VideoEditor.createThumbnail(
createThumbnailSuccess, // success cb
createThumbnailError, // error cb
{
fileUri: filePath, // the path to the video on the device
outputFileName: fileName + '_thumbnail', // the file name for the JPEG image
}
);
function createThumbnailSuccess(result) {
// result is the path to the jpeg image on the device
console.log('createThumbnailSuccess, result: ' + result);
}
function createThumbnailError(result) {
// result is the path to the jpeg image on the device
console.log('createThumbnailError, result: ' + result);
}
}
I'm not if it makes a difference but the file uri is as follows /data/user/0/com.widgetid.cordova/cache/videoTmp_71.mp4
.
I have also tried adding the following to my config.xml
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="AndroidExtraFilesystems" value="sdcard,cache" />
I've managed to resolve the problem for myself. I do not require cordova-plugin-android-permissions I just had to update the fileUri as follows: fileUri: 'file://' + filePath,
I am also having this issue, none of the above solutions are working.
I'm using the AlexMiniApps fork btw: https://github.com/AlexMiniApps/cordova-plugin-video-editor
I'm testing on a OnePlus 8 Pro running Android 11.
I'm requesting permissions at runtime and they are also declared in the manifest file.
Does anyone have a solution?