简体   繁体   English

Phonegap 3.3上的相机插件问题

[英]Camera Plugin Issue on Phonegap 3.3

I'm trying to use the Full Example given in: 我正在尝试使用下面给出的完整示例:

http://docs.phonegap.com/en/3.3.0/cordova_camera_camera.md.html#camera.getPicture http://docs.phonegap.com/en/3.3.0/cordova_camera_camera.md.html#camera.getPicture

I've created a project, added platform Android, added the Camera Plugin, Then I've copied the example as is into index.html . 我创建了一个项目,添加了Android平台,添加了Camera Plugin,然后将示例原样复制到index.html中。

Ran it on an Android 4.3 device, I see an error in the Eclipse's console: 在Android 4.3设备上运行它,我在Eclipse的控制台中看到一个错误:

01-22 19:48:26.661: E/Web Console(22707): Uncaught TypeError: Cannot read property 'PictureSourceType' of undefined:19 01-22 19:48:26.661:E / Web控制台(22707):未捕获的TypeError:无法读取未定义的属性'PictureSourceType':19

(Yes onDeviceReady() is fired like it should) (是的,onDeviceReady()被触发了)

What am I doing wrong ? 我究竟做错了什么 ?

Thanks. 谢谢。

Try changing: 尝试更改:

pictureSource=navigator.camera.PictureSourceType;

to: 至:

pictureSource=navigator.camera.PictureSourceType.CAMERA;

If you use phongap build you have to add: 如果使用phongap build,则必须添加:

<gap:plugin name="org.apache.cordova.core.camera" />

to your config.xml no need cordova add plugin etc.. 到您的config.xml中,不需要cordova添加插件等。

From what I've experienced with this camera plugin, sometimes the plugin won't expose the window.camera as is. 根据我对这个相机插件的经验,有时该插件不会按原样公开window.camera。 Instead, try to access it through window.plugins , and if that doesn't work either, try using ngCordova with which you will be able to get it working faster. 而是尝试通过window.plugins访问它,如果该方法也不起作用,请尝试使用ngCordova ,它将使它能够更快地工作。

You should also know that there are some bugs in Android which may crash the Android app. 您还应该知道,Android中存在一些错误,可能会导致Android应用崩溃。

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

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