Merge branch 'CB-6963' of https://github.com/martincgg/cordova-mobile-spec
diff --git a/www/accelerometer/index.html b/www/accelerometer/index.html
deleted file mode 100644
index 71000b8..0000000
--- a/www/accelerometer/index.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova-incl.js"></script>
- <script type="text/javascript" charset="utf-8" src="./index.js"></script>
-
- </head>
- <body id="stage" class="theme">
-
- <h1>Acceleration</h1>
- <div id="info">
- <div id="accel_status">Stopped</div>
- <div ><table width="100%">
- <tr><td width="20%">X:</td><td id="x"> </td></tr>
- <tr><td width="20%">Y:</td><td id="y"> </td></tr>
- <tr><td width="20%">Z:</td><td id="z"> </td></tr>
- </table></div>
- </div>
-
- <h2>Action</h2>
- <div class="btn large getAccel">Get Acceleration</div>
- <div class="btn large watchAccel">Start Watch</div>
- <div class="btn large stopAccel">Clear Watch</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
diff --git a/www/accelerometer/index.js b/www/accelerometer/index.js
deleted file mode 100644
index 946cfe2..0000000
--- a/www/accelerometer/index.js
+++ /dev/null
@@ -1,111 +0,0 @@
-var deviceReady = false;
-
-function roundNumber(num) {
- var dec = 3;
- var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
- return result;
-}
-
-//-------------------------------------------------------------------------
-// Acceleration
-//-------------------------------------------------------------------------
-var watchAccelId = null;
-
-/**
- * Start watching acceleration
- */
-var watchAccel = function() {
- console.log("watchAccel()");
-
- // Success callback
- var success = function(a){
- document.getElementById('x').innerHTML = roundNumber(a.x);
- document.getElementById('y').innerHTML = roundNumber(a.y);
- document.getElementById('z').innerHTML = roundNumber(a.z);
- console.log("watchAccel success callback");
- };
-
- // Fail callback
- var fail = function(e){
- console.log("watchAccel fail callback with error code "+e);
- stopAccel();
- setAccelStatus(Accelerometer.ERROR_MSG[e]);
- };
-
- // Update acceleration every 1 sec
- var opt = {};
- opt.frequency = 1000;
- watchAccelId = navigator.accelerometer.watchAcceleration(success, fail, opt);
-
- setAccelStatus("Running");
-};
-
-/**
- * Stop watching the acceleration
- */
-var stopAccel = function() {
- console.log("stopAccel()");
- setAccelStatus("Stopped");
- if (watchAccelId) {
- navigator.accelerometer.clearWatch(watchAccelId);
- watchAccelId = null;
- }
-};
-
-/**
- * Get current acceleration
- */
-var getAccel = function() {
- console.log("getAccel()");
-
- // Stop accel if running
- stopAccel();
-
- // Success callback
- var success = function(a){
- document.getElementById('x').innerHTML = roundNumber(a.x);
- document.getElementById('y').innerHTML = roundNumber(a.y);
- document.getElementById('z').innerHTML = roundNumber(a.z);
- };
-
- // Fail callback
- var fail = function(e){
- console.log("getAccel fail callback with error code "+e);
- setAccelStatus(Accelerometer.ERROR_MSG[e]);
- };
-
- // Make call
- var opt = {};
- navigator.accelerometer.getCurrentAcceleration(success, fail, opt);
-};
-
-/**
- * Set accelerometer status
- */
-var setAccelStatus = function(status) {
- document.getElementById('accel_status').innerHTML = status;
-};
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- console.log("accelerometer.init()");
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Apache Cordova did not initialize. Demo will not run correctly.");
- }
- },1000);
-}
-
-window.onload = function() {
- addListenerToClass('getAccel', getAccel);
- addListenerToClass('watchAccel', watchAccel);
- addListenerToClass('stopAccel', stopAccel);
- addListenerToClass('backBtn', backHome);
- init();
-}
diff --git a/www/autotest/pages/accelerometer.html b/www/autotest/pages/accelerometer.html
deleted file mode 100644
index 52b333b..0000000
--- a/www/autotest/pages/accelerometer.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
-<head>
- <title>Cordova: Accelerometer API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
-
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/accelerometer.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
diff --git a/www/autotest/pages/camera.html b/www/autotest/pages/camera.html
deleted file mode 100644
index 91843d7..0000000
--- a/www/autotest/pages/camera.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
-
-<head>
- <title>Cordova: Camera API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
-
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/camera.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
diff --git a/www/autotest/pages/capture.html b/www/autotest/pages/capture.html
deleted file mode 100644
index bac570f..0000000
--- a/www/autotest/pages/capture.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
-
-<head>
- <title>Cordova: Capture API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/capture.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a class="backBtn">Back</a>
-</body>
-</html>
-
diff --git a/www/autotest/tests/accelerometer.tests.js b/www/autotest/tests/accelerometer.tests.js
deleted file mode 100644
index 029db05..0000000
--- a/www/autotest/tests/accelerometer.tests.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe('Accelerometer (navigator.accelerometer)', function () {
- it("accelerometer.spec.1 should exist", function () {
- expect(navigator.accelerometer).toBeDefined();
- });
-
- describe("getCurrentAcceleration", function() {
- afterEach(function(){
- // wait between testcases to avoid interference
- var flag=false;
- runs(function() {
- setTimeout(function() {flag = true;}, 500);
- });
-
- waitsFor(function() {return flag;}, "flag to be true", Tests.TEST_TIMEOUT);
- });
-
- it("accelerometer.spec.2 should exist", function() {
- expect(typeof navigator.accelerometer.getCurrentAcceleration).toBeDefined();
- expect(typeof navigator.accelerometer.getCurrentAcceleration == 'function').toBe(true);
- });
-
- it("accelerometer.spec.3 success callback should be called with an Acceleration object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(a.x).toBeDefined();
- expect(typeof a.x == 'number').toBe(true);
- expect(a.y).toBeDefined();
- expect(typeof a.y == 'number').toBe(true);
- expect(a.z).toBeDefined();
- expect(typeof a.z == 'number').toBe(true);
- expect(a.timestamp).toBeDefined();
- expect(typeof a.timestamp).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.accelerometer.getCurrentAcceleration(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("accelerometer.spec.4 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function() {
- var reasonableThreshold = 15;
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a.x).toBeLessThan(reasonableThreshold);
- expect(a.x).toBeGreaterThan(reasonableThreshold * -1);
- expect(a.y).toBeLessThan(reasonableThreshold);
- expect(a.y).toBeGreaterThan(reasonableThreshold * -1);
- expect(a.z).toBeLessThan(reasonableThreshold);
- expect(a.z).toBeGreaterThan(reasonableThreshold * -1);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.accelerometer.getCurrentAcceleration(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("accelerometer.spec.5 success callback Acceleration object should return a recent timestamp", function() {
- // Check that timestamp returned is within a reasonable window.
- var veryRecently = (new Date()).getTime()-1000; // lower bound - 1 second prior
- var reasonableTimeLimit = veryRecently + 6000; // upper bound - 5 seconds from now
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a.timestamp).toBeGreaterThan(veryRecently);
- expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.accelerometer.getCurrentAcceleration(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("watchAcceleration", function() {
- var id;
-
- afterEach(function() {
- navigator.accelerometer.clearWatch(id);
- });
-
- it("accelerometer.spec.6 should exist", function() {
- expect(navigator.accelerometer.watchAcceleration).toBeDefined();
- expect(typeof navigator.accelerometer.watchAcceleration == 'function').toBe(true);
- });
- it("accelerometer.spec.7 success callback should be called with an Acceleration object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(a.x).toBeDefined();
- expect(typeof a.x == 'number').toBe(true);
- expect(a.y).toBeDefined();
- expect(typeof a.y == 'number').toBe(true);
- expect(a.z).toBeDefined();
- expect(typeof a.z == 'number').toBe(true);
- expect(a.timestamp).toBeDefined();
- expect(typeof a.timestamp).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- id = navigator.accelerometer.watchAcceleration(win, fail, {frequency:500});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("accelerometer.spec.8 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function() {
- var reasonableThreshold = 15;
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a.x).toBeLessThan(reasonableThreshold);
- expect(a.x).toBeGreaterThan(reasonableThreshold * -1);
- expect(a.y).toBeLessThan(reasonableThreshold);
- expect(a.y).toBeGreaterThan(reasonableThreshold * -1);
- expect(a.z).toBeLessThan(reasonableThreshold);
- expect(a.z).toBeGreaterThan(reasonableThreshold * -1);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- id = navigator.accelerometer.watchAcceleration(win, fail, {frequency:500});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("accelerometer.spec.9 success callback Acceleration object should return a recent timestamp", function() {
- // Check that timestamp returned is within a reasonable window.
- var veryRecently = (new Date()).getTime()-1000; // lower bound - 1 second prior
- var reasonableTimeLimit = veryRecently + 6000; // upper bound - 5 seconds from now
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a.timestamp).toBeGreaterThan(veryRecently);
- expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- id = navigator.accelerometer.watchAcceleration(win, fail, {frequency:500});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("clearWatch", function() {
- it("accelerometer.spec.10 should exist", function() {
- expect(navigator.accelerometer.clearWatch).toBeDefined();
- expect(typeof navigator.accelerometer.clearWatch == 'function').toBe(true);
- });
-
- it("accelerometer.spec.11 should clear an existing watch", function() {
- var id,
- win = jasmine.createSpy();
-
- runs(function() {
- id = navigator.accelerometer.watchAcceleration(win, function() {}, {frequency:100});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- win.reset();
- navigator.accelerometer.clearWatch(id);
- });
-
- waits(201);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- });
- });
- });
-});
diff --git a/www/autotest/tests/camera.tests.js b/www/autotest/tests/camera.tests.js
deleted file mode 100644
index ee5bacd..0000000
--- a/www/autotest/tests/camera.tests.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe('Camera (navigator.camera)', function () {
- it("should exist", function() {
- expect(navigator.camera).toBeDefined();
- });
-
- it("should contain a getPicture function", function() {
- expect(navigator.camera.getPicture).toBeDefined();
- expect(typeof navigator.camera.getPicture == 'function').toBe(true);
- });
-});
-
-describe('Camera Constants (window.Camera + navigator.camera)', function () {
- it("camera.spec.1 window.Camera should exist", function() {
- expect(window.Camera).toBeDefined();
- });
-
- it("camera.spec.2 should contain three DestinationType constants", function() {
- expect(Camera.DestinationType.DATA_URL).toBe(0);
- expect(Camera.DestinationType.FILE_URI).toBe(1);
- expect(Camera.DestinationType.NATIVE_URI).toBe(2);
- expect(navigator.camera.DestinationType.DATA_URL).toBe(0);
- expect(navigator.camera.DestinationType.FILE_URI).toBe(1);
- expect(navigator.camera.DestinationType.NATIVE_URI).toBe(2);
- });
-
- it("camera.spec.3 should contain two EncodingType constants", function() {
- expect(Camera.EncodingType.JPEG).toBe(0);
- expect(Camera.EncodingType.PNG).toBe(1);
- expect(navigator.camera.EncodingType.JPEG).toBe(0);
- expect(navigator.camera.EncodingType.PNG).toBe(1);
- });
-
- it("camera.spec.4 should contain three MediaType constants", function() {
- expect(Camera.MediaType.PICTURE).toBe(0);
- expect(Camera.MediaType.VIDEO).toBe(1);
- expect(Camera.MediaType.ALLMEDIA).toBe(2);
- expect(navigator.camera.MediaType.PICTURE).toBe(0);
- expect(navigator.camera.MediaType.VIDEO).toBe(1);
- expect(navigator.camera.MediaType.ALLMEDIA).toBe(2);
- });
- it("camera.spec.5 should contain three PictureSourceType constants", function() {
- expect(Camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
- expect(Camera.PictureSourceType.CAMERA).toBe(1);
- expect(Camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
- expect(navigator.camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
- expect(navigator.camera.PictureSourceType.CAMERA).toBe(1);
- expect(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
- });
-});
diff --git a/www/autotest/tests/capture.tests.js b/www/autotest/tests/capture.tests.js
deleted file mode 100644
index 99ce438..0000000
--- a/www/autotest/tests/capture.tests.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe('Capture (navigator.device.capture)', function () {
- it("capture.spec.1 should exist", function() {
- expect(navigator.device).toBeDefined();
- expect(navigator.device.capture).toBeDefined();
- });
-
- it("capture.spec.2 should have the correct properties ", function() {
- expect(navigator.device.capture.supportedAudioModes).toBeDefined();
- expect(navigator.device.capture.supportedImageModes).toBeDefined();
- expect(navigator.device.capture.supportedVideoModes).toBeDefined();
- });
-
- it("capture.spec.3 should contain a captureAudio function", function() {
- expect(navigator.device.capture.captureAudio).toBeDefined();
- expect(typeof navigator.device.capture.captureAudio == 'function').toBe(true);
- });
-
- it("capture.spec.4 should contain a captureImage function", function() {
- expect(navigator.device.capture.captureImage).toBeDefined();
- expect(typeof navigator.device.capture.captureImage == 'function').toBe(true);
- });
-
- it("capture.spec.5 should contain a captureVideo function", function() {
- expect(navigator.device.capture.captureVideo).toBeDefined();
- expect(typeof navigator.device.capture.captureVideo == 'function').toBe(true);
- });
-
- describe('CaptureAudioOptions', function () {
- it("capture.spec.6 CaptureAudioOptions constructor should exist", function() {
- var options = new CaptureAudioOptions();
- expect(options).toBeDefined();
- expect(options.limit).toBeDefined();
- expect(options.duration).toBeDefined();
- });
- });
-
- describe('CaptureImageOptions', function () {
- it("capture.spec.7 CaptureImageOptions constructor should exist", function() {
- var options = new CaptureImageOptions();
- expect(options).toBeDefined();
- expect(options.limit).toBeDefined();
- });
- });
-
- describe('CaptureVideoOptions', function () {
- it("capture.spec.8 CaptureVideoOptions constructor should exist", function() {
- var options = new CaptureVideoOptions();
- expect(options).toBeDefined();
- expect(options.limit).toBeDefined();
- expect(options.duration).toBeDefined();
- });
- });
-
- describe('CaptureError interface', function () {
- it("capture.spec.9 CaptureError constants should be defined", function() {
- expect(CaptureError.CAPTURE_INTERNAL_ERR).toBe(0);
- expect(CaptureError.CAPTURE_APPLICATION_BUSY).toBe(1);
- expect(CaptureError.CAPTURE_INVALID_ARGUMENT).toBe(2);
- expect(CaptureError.CAPTURE_NO_MEDIA_FILES).toBe(3);
- });
-
- it("capture.spec.10 CaptureError properties should exist", function() {
- var error = new CaptureError();
- expect(error).toBeDefined();
- expect(error.code).toBeDefined();
- });
- });
-
- describe('MediaFileData', function () {
- it("capture.spec.11 MediaFileData constructor should exist", function() {
- var fileData = new MediaFileData();
- expect(fileData).toBeDefined();
- expect(fileData.bitrate).toBeDefined();
- expect(fileData.codecs).toBeDefined();
- expect(fileData.duration).toBeDefined();
- expect(fileData.height).toBeDefined();
- expect(fileData.width).toBeDefined();
- });
- });
-
- describe('MediaFile', function () {
- it("capture.spec.12 MediaFile constructor should exist", function() {
- var fileData = new MediaFile();
- expect(fileData).toBeDefined();
- expect(fileData.name).toBeDefined();
- expect(fileData.type).toBeDefined();
- expect(fileData.lastModifiedDate).toBeDefined();
- expect(fileData.size).toBeDefined();
- });
- });
-});
diff --git a/www/camera/index.html b/www/camera/index.html
deleted file mode 100644
index 4f48190..0000000
--- a/www/camera/index.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova-incl.js"></script>
- <script type="text/javascript" charset="utf-8" src="./index.js"></script>
-
- </head>
- <body id="stage" class="theme">
-
- <h1>Camera</h1>
- <div id="info" style="white-space: pre-wrap">
- <b>Status:</b> <div id="camera_status"></div>
- img: <img width="100" id="camera_image">
- canvas: <canvas id="canvas" width="1" height="1"></canvas>
- </div>
- <h2>Cordova Camera API</h2>
- <div id="image-options"></div>
- <div class="btn large getPicture">camera.getPicture()</div>
- <h2>Native File Inputs</h2>
- <div>input type=file <input type="file" class="testInputTag"></div>
- <div>capture=camera <input type="file" accept="image/*;capture=camera" class="testInputTag"></div>
- <div>capture=camcorder <input type="file" accept="video/*;capture=camcorder" class="testInputTag"></div>
- <div>capture=microphone <input type="file" accept="audio/*;capture=microphone" class="testInputTag"></div>
- <h2>Actions</h2>
- <div class="btn large getFileInfo">Get File Metadata</div>
- <div class="btn large readFile">Read with FileReader</div>
- <div class="btn large copyImage">Copy Image</div>
- <div class="btn large writeImage">Write Image</div>
- <div class="btn large uploadImage">Upload Image</div>
- <div class="btn large displayImageUsingCanvas">Draw Using Canvas</div>
- <div class="btn large removeImage">Remove Image</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
diff --git a/www/camera/index.js b/www/camera/index.js
deleted file mode 100644
index f9435d0..0000000
--- a/www/camera/index.js
+++ /dev/null
@@ -1,344 +0,0 @@
-var deviceReady = false;
-var platformId = cordova.require('cordova/platform').id;
-var pictureUrl = null;
-var fileObj = null;
-var fileEntry = null;
-var pageStartTime = +new Date();
-
-//default camera options
-var camQualityDefault = ['quality value', 50];
-var camDestinationTypeDefault = ['FILE_URI', 1];
-var camPictureSourceTypeDefault = ['CAMERA', 1];
-var camAllowEditDefault = ['allowEdit', false];
-var camEncodingTypeDefault = ['JPEG', 0];
-var camMediaTypeDefault = ['mediaType', 0];
-var camCorrectOrientationDefault = ['correctOrientation', false];
-var camSaveToPhotoAlbumDefault = ['saveToPhotoAlbum', true];
-
-
-//-------------------------------------------------------------------------
-// Camera
-//-------------------------------------------------------------------------
-
-function log(value) {
- console.log(value);
- document.getElementById('camera_status').textContent += (new Date() - pageStartTime) / 1000 + ': ' + value + '\n';
-}
-
-function clearStatus() {
- document.getElementById('camera_status').innerHTML = '';
- document.getElementById('camera_image').src = 'about:blank';
- var canvas = document.getElementById('canvas');
- canvas.width = canvas.height = 1;
- pictureUrl = null;
- fileObj = null;
- fileEntry = null;
-}
-
-function setPicture(url, callback) {
-try {
- window.atob(url);
- // if we got here it is a base64 string (DATA_URL)
- url = "data:image/jpeg;base64," + url;
-} catch (e) {
- // not DATA_URL
- log('URL: ' + url.slice(0, 100));
-}
-
- pictureUrl = url;
- var img = document.getElementById('camera_image');
- var startTime = new Date();
- img.src = url;
- img.onloadend = function() {
- log('Image tag load time: ' + (new Date() - startTime));
- callback && callback();
- };
-}
-
-function onGetPictureError(e) {
- log('Error getting picture: ' + e.code);
-}
-
-function getPictureWin(data) {
- setPicture(data);
- // TODO: Fix resolveLocalFileSystemURI to work with native-uri.
- if (pictureUrl.indexOf('file:') == 0 || pictureUrl.indexOf('content:') == 0) {
- resolveLocalFileSystemURI(data, function(e) {
- fileEntry = e;
- logCallback('resolveLocalFileSystemURI()', true)(e.toURL());
- }, logCallback('resolveLocalFileSystemURI()', false));
- } else if (pictureUrl.indexOf('data:image/jpeg;base64' == 0)) {
- // do nothing
- } else {
- var path = pictureUrl.replace(/^file:\/\/(localhost)?/, '').replace(/%20/g, ' ');
- fileEntry = new FileEntry('image_name.png', path);
- }
-}
-
-function getPicture() {
- clearStatus();
- var options = extractOptions();
- log('Getting picture with options: ' + JSON.stringify(options));
- var popoverHandle = navigator.camera.getPicture(getPictureWin, onGetPictureError, options);
-
- // Reposition the popover if the orientation changes.
- window.onorientationchange = function() {
- var newPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, 0);
- popoverHandle.setPosition(newPopoverOptions);
- }
-}
-
-function uploadImage() {
- var ft = new FileTransfer(),
- uploadcomplete=0,
- progress = 0,
- options = new FileUploadOptions();
- options.fileKey="photo";
- options.fileName='test.jpg';
- options.mimeType="image/jpeg";
- ft.onprogress = function(progressEvent) {
- log('progress: ' + progressEvent.loaded + ' of ' + progressEvent.total);
- };
- var server = "http://cordova-filetransfer.jitsu.com";
-
- ft.upload(pictureUrl, server + '/upload', win, fail, options);
- function win(information_back){
- log('upload complete');
- }
- function fail(message) {
- log('upload failed: ' + JSON.stringify(message));
- }
-}
-
-function logCallback(apiName, success) {
- return function() {
- log('Call to ' + apiName + (success ? ' success: ' : ' failed: ') + JSON.stringify([].slice.call(arguments)));
- };
-}
-
-/**
- * Select image from library using a NATIVE_URI destination type
- * This calls FileEntry.getMetadata, FileEntry.setMetadata, FileEntry.getParent, FileEntry.file, and FileReader.readAsDataURL.
- */
-function readFile() {
- function onFileReadAsDataURL(evt) {
- var img = document.getElementById('camera_image');
- img.style.visibility = "visible";
- img.style.display = "block";
- img.src = evt.target.result;
- log("FileReader.readAsDataURL success");
- };
-
- function onFileReceived(file) {
- log('Got file: ' + JSON.stringify(file));
- fileObj = file;
-
- var reader = new FileReader();
- reader.onload = function() {
- log('FileReader.readAsDataURL() - length = ' + reader.result.length);
- };
- reader.onerror = logCallback('FileReader.readAsDataURL', false);
- reader.readAsDataURL(file);
- };
- // Test out onFileReceived when the file object was set via a native <input> elements.
- if (fileObj) {
- onFileReceived(fileObj);
- } else {
- fileEntry.file(onFileReceived, logCallback('FileEntry.file', false));
- }
-}
-function getFileInfo() {
- // Test FileEntry API here.
- fileEntry.getMetadata(logCallback('FileEntry.getMetadata', true), logCallback('FileEntry.getMetadata', false));
- fileEntry.setMetadata(logCallback('FileEntry.setMetadata', true), logCallback('FileEntry.setMetadata', false), { "com.apple.MobileBackup": 1 });
- fileEntry.getParent(logCallback('FileEntry.getParent', true), logCallback('FileEntry.getParent', false));
- fileEntry.getParent(logCallback('FileEntry.getParent', true), logCallback('FileEntry.getParent', false));
-};
-
-/**
- * Copy image from library using a NATIVE_URI destination type
- * This calls FileEntry.copyTo and FileEntry.moveTo.
- */
-function copyImage() {
- var onFileSystemReceived = function(fileSystem) {
- var destDirEntry = fileSystem.root;
-
- // Test FileEntry API here.
- fileEntry.copyTo(destDirEntry, 'copied_file.png', logCallback('FileEntry.copyTo', true), logCallback('FileEntry.copyTo', false));
- fileEntry.moveTo(destDirEntry, 'moved_file.png', logCallback('FileEntry.moveTo', true), logCallback('FileEntry.moveTo', false));
- };
-
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, onFileSystemReceived, null);
-};
-
-/**
- * Write image to library using a NATIVE_URI destination type
- * This calls FileEntry.createWriter, FileWriter.write, and FileWriter.truncate.
- */
-function writeImage() {
- var onFileWriterReceived = function(fileWriter) {
- fileWriter.onwrite = logCallback('FileWriter.write', true);
- fileWriter.onerror = logCallback('FileWriter.write', false);
- fileWriter.write("some text!");
- };
-
- var onFileTruncateWriterReceived = function(fileWriter) {
- fileWriter.onwrite = logCallback('FileWriter.truncate', true);
- fileWriter.onerror = logCallback('FileWriter.truncate', false);
- fileWriter.truncate(10);
- };
-
- fileEntry.createWriter(onFileWriterReceived, logCallback('FileEntry.createWriter', false));
- fileEntry.createWriter(onFileTruncateWriterReceived, null);
-};
-
-function displayImageUsingCanvas() {
- var canvas = document.getElementById('canvas');
- var img = document.getElementById('camera_image');
- var w = img.width;
- var h = img.height;
- h = 100 / w * h;
- w = 100;
- canvas.width = w;
- canvas.height= h;
- var context = canvas.getContext('2d');
- context.drawImage(img, 0, 0, w, h);
-};
-
-/**
- * Remove image from library using a NATIVE_URI destination type
- * This calls FileEntry.remove.
- */
-function removeImage() {
- fileEntry.remove(logCallback('FileEntry.remove', true), logCallback('FileEntry.remove', false));
-};
-
-function testInputTag(inputEl) {
- clearStatus();
- // iOS 6 likes to dead-lock in the onchange context if you
- // do any alerts or try to remote-debug.
- window.setTimeout(function() {
- testNativeFile2(inputEl);
- }, 0);
-};
-
-function testNativeFile2(inputEl) {
- if (!inputEl.value) {
- alert('No file selected.');
- return;
- }
- fileObj = inputEl.files[0];
- if (!fileObj) {
- alert('Got value but no file.');
- return;
- }
- var URLApi = window.URL || window.webkitURL;
- if (URLApi) {
- var blobURL = URLApi.createObjectURL(fileObj);
- if (blobURL) {
- setPicture(blobURL, function() {
- URLApi.revokeObjectURL(blobURL);
- });
- } else {
- log('URL.createObjectURL returned null');
- }
- } else {
- log('URL.createObjectURL() not supported.');
- }
-}
-
-function extractOptions() {
- var els = document.querySelectorAll('#image-options select');
- var ret = {};
- for (var i = 0, el; el = els[i]; ++i) {
- var value = el.value;
- if (value === '') continue;
- if (el.isBool) {
- ret[el.keyName] = !!+value;
- } else {
- ret[el.keyName] = +value;
- }
- }
- return ret;
-}
-
-function createOptionsEl(name, values, selectionDefault) {
- var container = document.createElement('div');
- container.style.display = 'inline-block';
- container.appendChild(document.createTextNode(name + ': '));
- var select = document.createElement('select');
- select.keyName = name;
- container.appendChild(select);
-
- // if we didn't get a default value, insert the blank <default> entry
- if (selectionDefault == undefined) {
- var opt = document.createElement('option');
- opt.value = '';
- opt.text = '<default>';
- select.appendChild(opt);
- }
-
- select.isBool = typeof values == 'boolean';
- if (select.isBool) {
- values = {'true': 1, 'false': 0};
- }
-
- for (var k in values) {
- var opt = document.createElement('option');
- opt.value = values[k];
- opt.textContent = k;
- if (selectionDefault) {
- if (selectionDefault[0] == k) {
- opt.selected = true;
- }
- }
- select.appendChild(opt);
- }
- var optionsDiv = document.getElementById('image-options');
- optionsDiv.appendChild(container);
-}
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- createOptionsEl('sourceType', Camera.PictureSourceType, camPictureSourceTypeDefault);
- createOptionsEl('destinationType', Camera.DestinationType, camDestinationTypeDefault);
- createOptionsEl('encodingType', Camera.EncodingType, camEncodingTypeDefault);
- createOptionsEl('mediaType', Camera.MediaType, camMediaTypeDefault);
- createOptionsEl('quality', {'0': 0, '50': 50, '80': 80, '100': 100}, camQualityDefault);
- createOptionsEl('targetWidth', {'50': 50, '200': 200, '800': 800, '2048': 2048});
- createOptionsEl('targetHeight', {'50': 50, '200': 200, '800': 800, '2048': 2048});
- createOptionsEl('allowEdit', true, camAllowEditDefault);
- createOptionsEl('correctOrientation', true, camCorrectOrientationDefault);
- createOptionsEl('saveToPhotoAlbum', true, camSaveToPhotoAlbumDefault);
- createOptionsEl('cameraDirection', Camera.Direction);
-
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Apache Cordova did not initialize. Demo will not run correctly.");
- }
- },1000);
-};
-
-window.onload = function() {
- addListenerToClass('getPicture', getPicture);
- addListenerToClass('testInputTag', function(e) {
- testInputTag(e.target);
- }, null, 'change', true);
- addListenerToClass('getFileInfo', getFileInfo);
- addListenerToClass('readFile', readFile);
- addListenerToClass('copyImage', copyImage);
- addListenerToClass('writeImage', writeImage);
- addListenerToClass('uploadImage', uploadImage);
- addListenerToClass('displayImageUsingCanvas', displayImageUsingCanvas);
- addListenerToClass('removeImage', removeImage);
-
- addListenerToClass('backBtn', backHome);
- init();
-}
-
diff --git a/www/capture/index.html b/www/capture/index.html
deleted file mode 100644
index 9543341..0000000
--- a/www/capture/index.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova-incl.js"></script>
- <script type="text/javascript" charset="utf-8" src="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>Capture</h1>
- <div id="info" style="white-space: pre-wrap">
- <b>Status:</b> <div id="camera_status"></div>
- img: <img width="100" id="camera_image">
- video: <div id="video_container"></div>
- </div>
-
- <h2>Cordova Capture API</h2>
- <div id="image-options"></div>
-
- <h2>Actions</h2>
- <div class="btn large getAudio">Capture 10 secs of audio and play</div>
- <div class="btn large getImage">Capture 1 image</div>
- <div class="btn large getVideo">Capture 10 secs of video</div>
- <div class="btn large resolveVideo">Capture 5 secs of video and resolve</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
diff --git a/www/capture/index.js b/www/capture/index.js
deleted file mode 100644
index 0f98549..0000000
--- a/www/capture/index.js
+++ /dev/null
@@ -1,137 +0,0 @@
-var deviceReady = false;
-var platformId = cordova.require('cordova/platform').id;
-var pageStartTime = +new Date();
-
-//-------------------------------------------------------------------------
-// Camera
-//-------------------------------------------------------------------------
-
-function log(value) {
- console.log(value);
- document.getElementById('camera_status').textContent += (new Date() - pageStartTime) / 1000 + ': ' + value + '\n';
-}
-
-function captureAudioWin(mediaFiles){
- var path = mediaFiles[0].fullPath;
- log('Audio captured: ' + path);
- var m = new Media(path);
- m.play();
-}
-
-function captureAudioFail(e){
- log('Error getting audio: ' + e.code);
-}
-
-function getAudio(){
- clearStatus();
- var options = { limit: 1, duration: 10};
- navigator.device.capture.captureAudio(captureAudioWin, captureAudioFail, options);
-}
-
-function captureImageWin(mediaFiles){
- var path = mediaFiles[0].fullPath;
- log('Image captured: ' + path);
- document.getElementById('camera_image').src = path;
-}
-
-function captureImageFail(e){
- log('Error getting image: ' + e.code);
-}
-
-function getImage(){
- clearStatus();
- var options = { limit: 1 };
- navigator.device.capture.captureImage(captureImageWin, captureImageFail, options);
-}
-
-function captureVideoWin(mediaFiles){
- var path = mediaFiles[0].fullPath;
- log('Video captured: ' + path);
-
- // need to inject the video element into the html
- // doesn't seem to work if you have a pre-existing video element and
- // add in a source tag
- var vid = document.createElement('video');
- vid.id="theVideo";
- vid.width = "320";
- vid.height= "240";
- vid.controls = "true";
- var source_vid = document.createElement('source');
- source_vid.id = "theSource";
- source_vid.src = path;
- vid.appendChild(source_vid);
- document.getElementById('video_container').appendChild(vid);
-}
-
-function captureVideoFail(e){
- log('Error getting video: ' + e.code);
-}
-
-function getVideo(){
- clearStatus();
- var options = { limit: 1, duration: 10 };
- navigator.device.capture.captureVideo(captureVideoWin, captureVideoFail, options);
-}
-
-function resolveMediaFileURL(mediaFile, callback) {
- resolveLocalFileSystemURL(mediaFile.localURL, function(entry) {
- log("Resolved by URL: " + mediaFile.localURL);
- if (callback) callback();
- }, function(err) {
- log("Failed to resolve by URL: " + mediaFile.localURL);
- log("Error: " + JSON.stringify(err));
- if (callback) callback();
- });
-}
-
-function resolveMediaFile(mediaFile, callback) {
- resolveLocalFileSystemURL(mediaFile.fullPath, function(entry) {
- log("Resolved by path: " + mediaFile.fullPath);
- if (callback) callback();
- }, function(err) {
- log("Failed to resolve by path: " + mediaFile.fullPath);
- log("Error: " + JSON.stringify(err));
- if (callback) callback();
- });
-}
-
-function resolveVideo() {
- clearStatus();
- var options = { limit: 1, duration: 5 };
- navigator.device.capture.captureVideo(function(mediaFiles) {
- captureVideoWin(mediaFiles);
- resolveMediaFile(mediaFiles[0], function() {
- resolveMediaFileURL(mediaFiles[0]);
- });
- }, captureVideoFail, options);
-}
-
-function clearStatus() {
- document.getElementById('camera_status').innerHTML = '';
- document.getElementById('camera_image').src = 'about:blank';
-}
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Apache Cordova did not initialize. Demo will not run correctly.");
- }
- },1000);
-};
-
-
-window.onload = function() {
- addListenerToClass('getAudio', getAudio);
- addListenerToClass('getImage', getImage);
- addListenerToClass('getVideo', getVideo);
- addListenerToClass('resolveVideo', resolveVideo);
- addListenerToClass('backBtn', backHome);
- init();
-}