Tutcugil
Tutcugil

Reputation: 358

cordova windows 8 app blob url to ms-appdata url

I'm working on a cordova windows 8 project, when i use camera.getPicture or captureVideo methods with FILE_URI parameter, it normally gives me local url of file on android, ios platforms but windows 8, it gives me like blob:9954c-xxx- etc

The problem is when i use this blob: url with filetransfer api, it gives me error Becouse filetransfer waits ms-appdata: url from windows platform

So is it possible to retrive ms-appdata url from blob url? Or how can use filetransfer with blob url?

Upvotes: 2

Views: 636

Answers (1)

Neil Palethorpe
Neil Palethorpe

Reputation: 389

Realise this is an old question now but I've recently had the same issue running Cordova 5.1.1 with the Camera plugin 1.2.0 where running the getPicture call on Windows 8.1 (Phone) to get a picture from the photo library was returning a 'blob:xxxx-xxxx...' string causing my window.resolveLocalFileSystemURI call to fail with code 5.

After a lot of messing around I found a workaround (and I haven't checked to see if this works on Android/iOS so you may need a switch for these to use the standard FILE_URI method) is to change the destinationType to DestinationType.NATIVE_URI. This seems to return a string Windows likes!

As I say though I haven't seen the result on Android/iOS so you may need a switch...

quality: 40,
allowEdit: true,
mediaType:navigator.camera.MediaType.PICTURE,
destinationType: (device.platform == 'windows' ? DestinationType.NATIVE_URI : DestinationType.FILE_URI),
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,

Hope that helps someone in the same situation.

Upvotes: 4

Related Questions