When my button is clicked, nothing happens.
<button onclick="captureVideo();">Capture Video</button>
I've put phonegap-1.4.1.js in the WWW folder.
I've included <script src="javascript/phonegap-1.4.1.js" type="text/javascript"></script>
in my head section.
I did all the supporting functions, as per Phonegap API Docs' example.
<script>
// Called when capture operation is finished
//
function captureSuccess(mediaFiles) {
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
uploadFile(mediaFiles[i]);
}
}
// Called if something bad happens.
//
function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
navigator.notification.alert(msg, null, 'Uh oh!');
}
// A button will call this function
//
function captureVideo() {
// Launch device video recording application,
// allowing user to capture up to 2 video clips
navigator.device.capture.captureVideo();
}
</script>
My other calls to other external js all work fine. Just phonegap-1.4.1.js isn't working. What am I missing here?
EDIT
When I pasted the phonegap js inline, then all my calls to those functions worked fine. So, I've established that the problem was it never loaded from externally. Diviceready alerts will tell me the same thing. But it doesn't MAKE it load. So, the question remains, how can I get the external js to load?
you need to make sure that deviceready event is firing. only after it fires would u be able to make phonegap api calls
You need to call
document.addEventListener ..
to ensure PhoneGap loaded, So Call init() method on your body onloadand put the below in your head tag
The file is here:
But you're including it in a different location:
It's not loading because it expects to find the file inside a javascript directory, while you've put it in the www folder. Make a dir "javascript" inside the www folder, or remove "javascript" from the src in your script tag.