Windows 8 - Cordova - navigator.camera.getPicture [英] Windows 8 - Cordova - navigator.camera.getPicture

查看:328
本文介绍了Windows 8 - Cordova - navigator.camera.getPicture的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Cordova / Phonegap 3.1.0将我们的HTML应用程序移植到Windows 8。大多数运行良好;然而,当我们使用FILE_URI导航拍摄照片时,我们会收到最初看起来像一个blob,但只是一个字符串(我相信)。



一个示例字符串使用以下代码时可以返回:

  blob:00000000-0000-0000-0000-000000000000 

使用:

  navigator.camera.getPicture(success,failure,{
quality:40,
destinationType:Camera.DestinationType.FILE_URI,
sourceType:Camera.PictureSourceType.CAMERA,
allowEdit:false ,
encodingType:Camera.EncodingType.JPEG,
targetWidth:320,
targetHeight:240
});


解决方案

目前似乎不支持这种方法: p>

http://cordova.apache.org/docs/en/3.1.0/cordova_file_file.md.html#File



所有文件数据都支持平台。在被写入文件系统之前,文本被编码为UTF-8。



支持的平台 >



文字和二进制支持:



Android



iOS



纯文字支援

BlackBerry WebWorks(OS 5.0及更高版本)



Windows Phone 7和8



Windows 8



我正在开发一个WinJS解决方案与平台检测。如果可能,我将更新此信息。


We are in the process of porting our HTML application to Windows 8 using Cordova/Phonegap 3.1.0. Most of it runs fine; however when we take a photo using the FILE_URI navigation, we receive what initially looks like a blob, but is just a string (I believe).

An example string I get back when using the following code, could be:

blob:00000000-0000-0000-0000-000000000000

Using:

navigator.camera.getPicture(success, failure, {
    quality: 40,
    destinationType: Camera.DestinationType.FILE_URI,
    sourceType: Camera.PictureSourceType.CAMERA,
    allowEdit: false,
    encodingType: Camera.EncodingType.JPEG,
    targetWidth: 320,
    targetHeight: 240
});

解决方案

Currently this does not seem to be supported:

http://cordova.apache.org/docs/en/3.1.0/cordova_file_file.md.html#File

Text data is supported by all platforms listed below. Text is encoded as UTF-8 before being written to the filesystem. Some platforms also support binary data, which can be passed in as either an ArrayBuffer or a Blob.

Supported Platforms

Text and Binary Support:

Android

iOS

Text-only Support:

BlackBerry WebWorks (OS 5.0 and higher)

Windows Phone 7 and 8

Windows 8

I am working on a WinJS workaround with platform detection. I will update this post if it is possible.

这篇关于Windows 8 - Cordova - navigator.camera.getPicture的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆