简体   繁体   English

cordova插件摄像头中FILE_URI和NATIVE_URI之间的区别

[英]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 如果你想将它们转换为其他网址,你可以使用文件插件: 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 以下是选项的文档: 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 以及此函数源代码的链接: https//github.com/apache/cordova-plugin-file/blob/master/www/resolveLocalFileSystemURI.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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