cordova-plugin-photo-library icon indicating copy to clipboard operation
cordova-plugin-photo-library copied to clipboard

saving videos ?

Open matrixreal opened this issue 8 years ago • 10 comments

Hi, i have put a videos in the www/videos folder (.mov) and i want to save it to photos gallery is it possible ? thanks

matrixreal avatar Feb 08 '17 14:02 matrixreal

Yes, it's possible. With help of cordova-plugin-file, something like this should do the job:

var url = cordova.file.applicationDirectory + 'www/videos/myVideo.mov';
cordova.plugins.photoLibrary.saveVideo(url, 'Album Name', function () {}, function (err) {});

viskin avatar Feb 08 '17 19:02 viskin

@viskin thank you i would like to save a live wallpaper so i need to save 2 files (for example video1.mov and video1.jpg) but i need to save files with same name (video1 for example) to the gallery photos is it possible ?

matrixreal avatar Feb 08 '17 19:02 matrixreal

@viskin any ideas please? thanks in advance

matrixreal avatar Feb 09 '17 14:02 matrixreal

@viskin http://stackoverflow.com/questions/17807507/save-photo-to-camera-roll-with-specific-filename maybe can help

matrixreal avatar Feb 09 '17 16:02 matrixreal

Are we talking about iOS? The plugin on iOS uses

ALAssetsLibrary.writeImageData(toSavedPhotosAlbum: sourceData, metadata: nil)

to save image, and

ALAssetsLibrary.writeVideoAtPath(toSavedPhotosAlbum: videoURL)

to save video. I don't know about possibility for these APIs to specify file name in the library. If there is, it shouldn't be complex to add this functionality to the plugin.

viskin avatar Feb 09 '17 16:02 viskin

@viskin yes for ios it will be perfect if you can add it i try to do it but not done

matrixreal avatar Feb 09 '17 16:02 matrixreal

@viskin i did search and try thing but did not work at all your help will be much appreciated

matrixreal avatar Feb 10 '17 11:02 matrixreal

I don't see iOS supports this functionality. Sorry. If it is, tell me how to do it, and I'll check if it possible to integrate it into the plugin.

viskin avatar Feb 10 '17 12:02 viskin

@viskin i find this link may can help http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/

matrixreal avatar Feb 11 '17 17:02 matrixreal

I'm getting an error when trying to save to video to photos app. Here is error output. Any suggestions? [Generic] Failed to load image data for asset <PHAsset: 0x101a1bcc0> AB67DE41-8F4F-4272-A112-792C6A2CB4E0/L0/001 mediaType=1/0, sourceType=1, (3000x3000), creationDate=2013-09-18 16:25:13 +0000, location=0, hidden=0, favorite=0 with format 9999

lhaggarty avatar Aug 11 '18 04:08 lhaggarty