cordova-plugin-video-editor icon indicating copy to clipboard operation
cordova-plugin-video-editor copied to clipboard

Can't access or make Movies directory

Open binoculars88 opened this issue 7 years ago • 8 comments

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.

binoculars88 avatar Jun 09 '17 07:06 binoculars88

Any news on this? I've got the same issue.

qbix0r avatar Sep 06 '17 14:09 qbix0r

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.

killerchip avatar Feb 07 '18 10:02 killerchip

I am having this issue.

Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: 100

ksoni23 avatar Mar 25 '18 08:03 ksoni23

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);
	}
}

Cozmoz avatar May 24 '21 20:05 Cozmoz

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.

Cozmoz avatar May 24 '21 22:05 Cozmoz

I have also tried adding the following to my config.xml

<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="AndroidExtraFilesystems" value="sdcard,cache" />

Cozmoz avatar May 24 '21 22:05 Cozmoz

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,

Cozmoz avatar May 26 '21 16:05 Cozmoz

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?

timmyrosen avatar Dec 22 '21 14:12 timmyrosen