You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/04/24 21:03:03 UTC

[2/3] git commit: adding video/image capture support

adding video/image capture support


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/9ba3a87a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/9ba3a87a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/9ba3a87a

Branch: refs/heads/master
Commit: 9ba3a87ab4bfcf2bc107a7de0628aebd37ab7810
Parents: f28da93
Author: Anis Kadri <an...@gmail.com>
Authored: Tue Apr 24 12:02:11 2012 -0700
Committer: Anis Kadri <an...@gmail.com>
Committed: Tue Apr 24 12:02:11 2012 -0700

----------------------------------------------------------------------
 lib/bada/plugin/bada/Capture.js |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/9ba3a87a/lib/bada/plugin/bada/Capture.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Capture.js b/lib/bada/plugin/bada/Capture.js
new file mode 100644
index 0000000..9d419ed
--- /dev/null
+++ b/lib/bada/plugin/bada/Capture.js
@@ -0,0 +1,22 @@
+module.exports = {
+    captureAudio: function() {
+      console.log("navigator.capture.captureAudio unsupported!");
+    },
+    captureVideo: function(success, fail, options) {
+          var camera = navigator.camera._mainCamera;
+      camera.startVideoCapture(success, fail, options);
+          if(options.duration) {
+            Osp.Core.Function.delay(camera.stopVideoCapture, options.duration, camera);
+          }
+    },
+    stopVideoCapture: function() {
+      navigator.camera._mainCamera.stopVideoCapture();
+    },
+    captureImage: function(success, fail, options) {
+      try {
+        navigator.camera._mainCamera.captureImage(success, fail, options);
+      } catch(exp) {
+        alert("Exception :[" + exp.code + "] " + exp.message);
+      }
+    }
+}