Merge branch 'CB-6959' of https://github.com/stacic/cordova-mobile-spec
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/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/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();
-}