简体   繁体   中英

Difference between FILE_URI and NATIVE_URI in cordova plugin camera

cordova插件相机中的FILE_URI和NATIVE_URI有什么不同?

There are three options, and from what I understand they are different per platform:

Camera.DestinationType.FILE_URI
    'file://' ios
    'content://' android

Camera.DestinationType.NATIVE_URI
    'assets-library://' ios
    'content://' android

Camera.DestinationType.DATA_URL
    'data:image/jpg;base64,'

If you want to convert them to other urls you can use the file plugin: https://github.com/apache/cordova-plugin-file

navigator.camera.getPicture(function (path) {
    window.alert('getPicture.success: ' + JSON.stringify(path));
    window.resolveLocalFileSystemURI(path, function (fileEntry) {
        window.alert("success: " + JSON.stringify(fileEntry));
    }, function (e) {
        window.alert("error: " + JSON.stringify(e));
    });
}, function (e) {
    window.alert('getPicture.error: ' + JSON.stringify(e));
}, $scope.options);

Here is the documentation for the options: https://github.com/apache/cordova-plugin-camera/blob/master/www/CameraConstants.js

And also the link to the source code for this function: https://github.com/apache/cordova-plugin-file/blob/master/www/resolveLocalFileSystemURI.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM