无法读取属性'DATA_URL'的未定义类型file:///android_asset/www/apis
Can not read propery 'DATA_URL' of undefined type at file:///android_asset/www/apis/camera.js:45
我是phonegap应用程序的新手,但我是一名android开发人员。我正试图在我的phonegap应用程序中点击按钮调用摄像头。下面是我在html中调用camera.jsapijavascript的take_pic()方法。在只看到api示例后,我在body中包含了camera.js。
<body>
<label for="hello">Hello World</label>
<br><input type="submit" id="submit" value="Call Camera" onclick="take_pic();">
<script type="text/javascript" charset="utf-8" src="apis/camera.js"></script>
</body>
以下是camera.js的方法,该方法被触发,但它在file:///android_asset/www/apis/camera.js:45"错误。请大家帮我。如果需要更多的细节,请告诉我
function take_pic() {
navigator.camera.getPicture(onPhotoDataSuccess, function(ex) {
alert("Camera Error!");
}, { quality : 30, destinationType: destinationType.DATA_URL });
}
您尝试了下一个代码吗?它在PhoneGap API示例中:PhoneGap示例
var pictureSource; // picture source
var destinationType; // sets the format of returned value
// Wait for device API libraries to load
//
document.addEventListener("deviceready",onDeviceReady,false);
// device APIs are available
//
function onDeviceReady() {
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
}
function take_pic() {
navigator.camera.getPicture(onPhotoDataSuccess, function(ex) {
alert("Camera Error!");
}, { quality : 30, destinationType: destinationType.DATA_URL });
}
我认为您的问题是变量"destinationType"未定义。您是否正确初始化了它?
相关文章:
- 正在将base64 jpeg从input-type=file上传到服务器
- 有人能告诉我如何在cent-os中打开扩展名为.dat的FIle吗
- File Upload事件上下文和javascript
- 使用jQuery File Upload实现所需的用户登录
- FileEntry.file方法使dataTransferItemList为空
- '的文件格式和扩展名;file.xls'don't与fileSaver.js匹配
- 有没有什么方法可以通过输入字段(type=file)来找出选择了多少个文件
- FF和Chrome中的 ftp:// 网页不会加载 file:// 脚本
- 将从浏览器创建的文件保存到磁盘 - 不能在 Firefox 上使用新的 File()
- 如何将标头中的全局变量加载到外部Javascript FIle中
- PrimeFaces p:file上传多个文件自动完成仅在第一个文件后有效
- 使用 Javascript SDK 创建 Parse.File
- Krajee Bootstrap file input dynamic maxFilecount
- File Upload & Google Protobuf
- Jquery ajax append html file based on url
- 正在将“grunt.file.readJSON”转换为gullow
- File.requestAllPaths,我们似乎缺少一些东西
- 未捕获的类型错误:无法读取属性'OneSignal'“未定义”;,来源:file:///android_
- Google APIs JS File
- 无法读取属性'DATA_URL'的未定义类型file:///android_asset/www/apis