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 7AE79DFFB for ; Tue, 10 Jul 2012 18:20:32 +0000 (UTC) Received: (qmail 96568 invoked by uid 500); 10 Jul 2012 18:20:32 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 96543 invoked by uid 500); 10 Jul 2012 18:20:32 -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 96536 invoked by uid 99); 10 Jul 2012 18:20:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2012 18:20:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 31605D6FD; Tue, 10 Jul 2012 18:20:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [1/2] spec commit: added seekTo and seekBy functionality to manual audio test Message-Id: <20120710182032.31605D6FD@tyr.zones.apache.org> Date: Tue, 10 Jul 2012 18:20:32 +0000 (UTC) Updated Branches: refs/heads/master 0d70bfd6d -> cb90fb14b added seekTo and seekBy functionality to manual audio test Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/d411e1aa Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/d411e1aa Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/d411e1aa Branch: refs/heads/master Commit: d411e1aafe50fd21abfc9e1427f5a10974b21a84 Parents: 0d70bfd Author: Lorin Beer Authored: Thu Jun 28 15:16:17 2012 -0700 Committer: Fil Maj Committed: Tue Jul 10 11:22:28 2012 -0700 ---------------------------------------------------------------------- audio/index.html | 91 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 88 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/d411e1aa/audio/index.html ---------------------------------------------------------------------- diff --git a/audio/index.html b/audio/index.html old mode 100755 new mode 100644 index 7961d74..42cfe83 --- a/audio/index.html +++ b/audio/index.html @@ -4,7 +4,7 @@ Cordova Audio Tests - + @@ -27,8 +27,8 @@ console.log("playAudio()"); console.log(" -- media="+media1); - //var src = "http://neuga.s3.amazonaws.com/onclassical/strings-organ.mp3"; - var src = "http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3"; + //var src = "http://neuga.s3.amazonaws.com/onclassical/strings-or gan.mp3"; + var src = "http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3"; //var src = "/android_asset/www/Jet_Sledding.mp4"; // no work //var src = "http://vprbbc.streamguys.net/vprbbc24.mp3"; // mp3 streaming @@ -266,7 +266,82 @@ } },1000); } + + /** + * for forced updates of position after a successful seek + */ + function updatePosition() { + media1.getCurrentPosition( + function(position) { + console.log("Pos="+position); + if (position >= 0.0) { + setAudioPosition(position+" sec"); + } + }, + function(e) { + console.log("Error getting pos="+e); + setAudioPosition("Error: "+e); + }); + } + /** + * + */ + function seekAudio(mode) { + var time = document.getElementById("seekinput").value; + if (time == "") { + time = 5000; + } else { + time = time * 1000; //we expect the input to be in seconds + } + if (media1 == null) { + console.log("seekTo requested while media1 is null"); + if (audioSrc == null) { + audioSrc = "http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3"; + } + media1 = new Media(audioSrc, + function() { + console.log("seekToAudio():Audio Success"); + }, + function(err) { + console.log("seekAudio():Audio Error: "+err.code); + setAudioStatus("Error: " + err.code); + }, + function(status) { + console.log("seekAudio():Audio Status: "+status); + setAudioStatus(Media.MEDIA_MSG[status]); + + // If stopped, then stop getting current position + if (Media.MEDIA_STOPPED == status) { + clearInterval(media1Timer); + media1Timer = null; + setAudioPosition("0 sec"); + } + }); + } + + media1.getCurrentPosition( + function (position) { + var deltat = time; + if (mode == "by") { + deltat = time + position * 1000; + } + media1.seekTo(deltat, + function () { + console.log("seekAudioTo():Audio Success"); + //force an update on the position display + updatePosition(); + }, + function (err) { + console.log("seekAudioTo():Audio Error: " + err.code); + }); + }, + function(e) { + console.log("Error getting pos="+e); + setAudioPosition("Error: "+e); + }); + } + @@ -291,6 +366,16 @@
Stop
+
Seek By
+
Seek To
+ +
+ +
+ +

s

+ +

Record Audio