简体   繁体   English

无法在文件:///android_asset/www/apis/camera.js:45读取未定义类型的属性“ DATA_URL”

[英]Can not read propery 'DATA_URL' of undefined type at file:///android_asset/www/apis/camera.js:45

I am very much new to phonegap applications but i am an android developer.I am trying to call camera on a button click in my phonegap application.Following is my html where i am calling take_pic() method of camera.js api javascript.I have included camera.js in body after seeing api example only. 我对phonegap应用程序非常陌生,但我是一名android开发人员。我试图在我的phonegap应用程序中单击按钮时调用camera。以下是我在html中调用camera.js api javascript.I的take_pic()方法的方法仅在看到api示例后才在体内包含了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>

following is the method of camera.js which is triggered but it throws "Can not read propery 'DATA_URL' of undefined type at file:///android_asset/www/apis/camera.js:45" error .Please guys help me out.let me know if more details are required 以下是被触发的camera.js方法,但抛出“无法在file:///android_asset/www/apis/camera.js:45读取未定义类型的属性'DATA_URL'”错误。请大家帮帮我。让我知道是否需要更多详细信息

function take_pic() {
  navigator.camera.getPicture(onPhotoDataSuccess, function(ex) {
    alert("Camera Error!");
  }, { quality : 30, destinationType: destinationType.DATA_URL });
}

Did you try the next code? 您是否尝试了下一个代码? it is in the PhoneGap API examples: PhoneGap example 它在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 });
}

I think your problem is that the variable "destinationType" is undefined. 我认为您的问题是变量“ destinationType”未定义。 Did you initialized it properly? 您是否正确初始化了?

暂无
暂无

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

相关问题 “初始化网络连接时出错:找不到类”,来源:file:///android_asset/www/cordova.js - “Error initializing Network Connection: Class not found”, source: file:///android_asset/www/cordova.js Phonegap:对象xx在文件中没有方法&#39;exec&#39;:///android_asset/www/cordova.js - Phonegap: Object xx has no method 'exec' at file:///android_asset/www/cordova.js 错误回调中的错误:TestPlugin2 = ReferenceError:找不到变量:登录文件:///android_asset/www/js/cordova-1.6.1.js:276 - Error in error callback: TestPlugin2 = ReferenceError: Can't find variable: log at file:///android_asset/www/js/cordova-1.6.1.js:276 路径“file:/// android_asset /”记录在哪里? - Where is the path “file:///android_asset/” documented? 无法加载位于 file:///android_asset/file.html 的网页,因为:net::ERR_FILE_NOT_FOUND - The webpage at file:///android_asset/file.html could not be loaded because: net::ERR_FILE_NOT_FOUND 无法以正确的编码从url读取js文件 - Can't read js file from url in correct encoding 如何在Android中从URL读取文本文件(非HTML)? - How can I read a text file (not HTML) from URL in Android? Android - 如何从网址读取文本文件? - Android - How can I read a text file from a url? 无法从 url 读取 js 文件 - 收到空的 html 文件 - Can't read js file from url - recieve empty html file Android:无法将从文件读取的数据传递给多个类 - Android: Can't Pass Data Read From File To Multiple Classes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM