You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/04/15 21:26:41 UTC

[2/2] spec commit: CB-6152: Add manual tests to check interaction between media-capture and file plugins

CB-6152: Add manual tests to check interaction between media-capture and file plugins


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/4c172047
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/4c172047
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/4c172047

Branch: refs/heads/master
Commit: 4c1720479b98a4631047fa18642daa1d77c398a0
Parents: 18617ee
Author: Ian Clelland <ic...@chromium.org>
Authored: Tue Apr 15 14:04:32 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Tue Apr 15 15:25:45 2014 -0400

----------------------------------------------------------------------
 capture/index.html | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/4c172047/capture/index.html
----------------------------------------------------------------------
diff --git a/capture/index.html b/capture/index.html
index 2d31f53..67c35e3 100644
--- a/capture/index.html
+++ b/capture/index.html
@@ -106,6 +106,39 @@
         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 = '';
@@ -146,6 +179,7 @@
     <div class="btn large" onclick="getAudio();">Capture 10 secs of audio and play</div>
     <div class="btn large" onclick="getImage();">Capture 1 image</div>
     <div class="btn large" onclick="getVideo();">Capture 10 secs of video</div>
+    <div class="btn large" onclick="resolveVideo();">Capture 5 secs of video and resolve</div>
     <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
   </body>
 </html>