You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by vi...@apache.org on 2015/04/28 02:18:18 UTC
[1/2] cordova-plugin-media git commit: CB-8793 Increased playback
timeout in tests
Repository: cordova-plugin-media
Updated Branches:
refs/heads/CB-8860cordova-plugin-media f04737ba4 -> a4953675a
CB-8793 Increased playback timeout in tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/commit/7d1fde04
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/7d1fde04
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/7d1fde04
Branch: refs/heads/CB-8860cordova-plugin-media
Commit: 7d1fde0417369666247b3283d4243afad32e27cb
Parents: f04737b
Author: alsorokin <al...@akvelon.com>
Authored: Mon Apr 27 12:36:22 2015 +0300
Committer: alsorokin <al...@akvelon.com>
Committed: Mon Apr 27 12:36:22 2015 +0300
----------------------------------------------------------------------
tests/tests.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/7d1fde04/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index ce683eb..1a5eb77 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -19,7 +19,7 @@
*
*/
// increased timeout for actual playback to give device chance to download and play mp3 file
-var ACTUAL_PLAYBACK_TEST_TIMEOUT = 10000;
+var ACTUAL_PLAYBACK_TEST_TIMEOUT = 30000;
var isWindows = cordova.platformId == 'windows8' || cordova.platformId == 'windows';
// detect whether audio hardware is available and enabled
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/2] cordova-plugin-media git commit: CB-8888 Makes media status
reporting on windows more precise
Posted by vi...@apache.org.
CB-8888 Makes media status reporting on windows more precise
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/commit/a4953675
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/a4953675
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/a4953675
Branch: refs/heads/CB-8860cordova-plugin-media
Commit: a4953675ac3faa6b7fa224ed18280efb216e2906
Parents: 7d1fde0
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Wed Apr 22 12:50:19 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Mon Apr 27 12:42:15 2015 +0300
----------------------------------------------------------------------
src/windows/MediaProxy.js | 59 ++++++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/a4953675/src/windows/MediaProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/MediaProxy.js b/src/windows/MediaProxy.js
index 1e51944..3768ebd 100644
--- a/src/windows/MediaProxy.js
+++ b/src/windows/MediaProxy.js
@@ -21,9 +21,7 @@
/*global Windows:true */
-var cordova = require('cordova'),
- Media = require('cordova-plugin-media.Media');
-
+var Media = require('cordova-plugin-media.Media');
var MediaError = require('cordova-plugin-media.MediaError');
var recordedFile;
@@ -36,7 +34,6 @@ module.exports = {
var id = args[0];
var src = args[1];
var thisM = Media.get(id);
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STARTING);
Media.prototype.node = null;
@@ -46,20 +43,37 @@ module.exports = {
fn === 'cda' || fn === 'adx' || fn === 'wm' ||
fn === 'm3u' || fn === 'wmx' || fn === 'm4a') {
thisM.node = new Audio(src);
- thisM.node.load();
-
- var getDuration = function () {
- var dur = thisM.node.duration;
- if (isNaN(dur)) {
- dur = -1;
- }
- Media.onStatus(id, Media.MEDIA_DURATION, dur);
+
+ thisM.node.onloadstart = function () {
+ Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STARTING);
};
- thisM.node.onloadedmetadata = getDuration;
- getDuration();
- }
- else {
+ thisM.node.ontimeupdate = function (e) {
+ Media.onStatus(id, Media.MEDIA_POSITION, e.target.currentTime);
+ };
+
+ thisM.node.onplaying = function () {
+ Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_RUNNING);
+ };
+
+ thisM.node.ondurationchange = function (e) {
+ Media.onStatus(id, Media.MEDIA_DURATION, e.target.duration || -1);
+ };
+
+ thisM.node.onerror = function(e) {
+ // Due to media.spec.15 It should return MediaError for bad filename
+ var err = e.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
+ { code: MediaError.MEDIA_ERR_ABORTED } :
+ e.target.error;
+
+ Media.onStatus(id, Media.MEDIA_ERROR, err);
+ };
+
+ thisM.node.onended = function () {
+ Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
+ };
+
+ } else {
lose && lose({ code: MediaError.MEDIA_ERR_ABORTED });
return false; // unable to create
}
@@ -86,7 +100,6 @@ module.exports = {
try {
thisM.node.play();
- Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_RUNNING);
} catch (err) {
lose && lose({code:MediaError.MEDIA_ERR_ABORTED});
}
@@ -98,12 +111,8 @@ module.exports = {
try {
var thisM = Media.get(id);
thisM.node.pause();
- if (thisM.node.currentTime != 0) {
- // prevents failing w/ InvalidStateError if playback has not started
- thisM.node.currentTime = 0;
- }
+ thisM.node.currentTime = 0;
Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
- win();
} catch (err) {
lose("Failed to stop: "+err);
}
@@ -113,9 +122,10 @@ module.exports = {
seekToAudio:function(win, lose, args) {
var id = args[0];
var milliseconds = args[1];
+ var thisM = Media.get(id);
try {
- (Media.get(id)).node.currentTime = milliseconds / 1000;
- win();
+ thisM.node.currentTime = milliseconds / 1000;
+ win(thisM.node.currentTime);
} catch (err) {
lose("Failed to seek: "+err);
}
@@ -138,7 +148,6 @@ module.exports = {
var id = args[0];
try {
var p = (Media.get(id)).node.currentTime;
- Media.onStatus(id, Media.MEDIA_POSITION, p);
win(p);
} catch (err) {
lose(err);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org