Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC8AB90DD for ; Sat, 28 Apr 2012 00:27:56 +0000 (UTC) Received: (qmail 10913 invoked by uid 500); 28 Apr 2012 00:27:56 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 10844 invoked by uid 500); 28 Apr 2012 00:27:56 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 10583 invoked by uid 99); 28 Apr 2012 00:27:56 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Apr 2012 00:27:56 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BC851EFA8; Sat, 28 Apr 2012 00:27:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [13/17] bada-wac commit: adding camera preview Message-Id: <20120428002755.BC851EFA8@tyr.zones.apache.org> Date: Sat, 28 Apr 2012 00:27:55 +0000 (UTC) adding camera preview Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/commit/06e81ddd Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/tree/06e81ddd Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/diff/06e81ddd Branch: refs/heads/master Commit: 06e81ddd2fd81c00d64d6beff472abb0b3969fdc Parents: fa18c75 Author: Anis Kadri Authored: Fri Apr 6 17:21:53 2012 -0700 Committer: Anis Kadri Committed: Fri Apr 6 17:21:53 2012 -0700 ---------------------------------------------------------------------- Res/index.html | 8 ++++++++ Res/js/camera.js | 26 ++++++++++++++++++++++++++ Res/js/sample.js | 4 ++++ 3 files changed, 38 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/06e81ddd/Res/index.html ---------------------------------------------------------------------- diff --git a/Res/index.html b/Res/index.html index 86cbf94..d75caae 100644 --- a/Res/index.html +++ b/Res/index.html @@ -98,7 +98,15 @@ button.btn { +
  • +

    Camera

    +
    + +
    +
    +
  • + http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/06e81ddd/Res/js/camera.js ---------------------------------------------------------------------- diff --git a/Res/js/camera.js b/Res/js/camera.js new file mode 100644 index 0000000..6d48436 --- /dev/null +++ b/Res/js/camera.js @@ -0,0 +1,26 @@ +navigator.camera = { + getPicture: function(cameraSuccess, cameraFailure, cameraOptions) { + // TODO + }, + getPreview: function() { + var onCreatePreviewNodeSuccess = function(previewObject) { + var previewDiv = document.getElementById("preview"); + previewId = previewObject.id; + previewDiv.appendChild(previewObject); + previewObject.style.visibility = "visible"; + }; + var error = function(e) { + alert("An error occured: " + e.message); + }; + + var success = function(cams) { + if (cams.length > 0) { + mainCamera = cams[0]; + mainCamera.createPreviewNode(onCreatePreviewNodeSuccess, error); + return; + } + alert("Sorry, no cameras available."); + }; + deviceapis.camera.getCameras(success, error); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/06e81ddd/Res/js/sample.js ---------------------------------------------------------------------- diff --git a/Res/js/sample.js b/Res/js/sample.js index 1ffd6ab..a0e58f3 100644 --- a/Res/js/sample.js +++ b/Res/js/sample.js @@ -198,4 +198,8 @@ function notificationBeep() { function notificationLightOn() { navigator.notification.lightOn(2000); +} + +function getCameraPreview() { + navigator.camera.getPreview(); } \ No newline at end of file