Loading src/windows/MediaProxy.js +6 −2 Changes for src/windows/MediaProxy.js: 6 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -96,8 +96,12 @@ module.exports = { stopPlayingAudio:function(win, lose, args) { var id = args[0]; try { (Media.get(id)).node.pause(); (Media.get(id)).node.currentTime = 0; 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; } Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED); win(); } catch (err) { Loading tests/tests.js +14 −0 Changes for tests/tests.js: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,10 @@ * */ var isWindows = cordova.platformId == 'windows8' || cordova.platformId == 'windows'; // detect whether audio hardware is available and enabled var isAudioSupported = isWindows ? Windows.Media.Devices.MediaDevice.getDefaultAudioRenderId(Windows.Media.Devices.AudioDeviceRole.default) : true; exports.defineAutoTests = function () { var failed = function (done, msg, error) { var info = typeof msg == 'undefined' ? 'Unexpected error callback' : msg; Loading Loading @@ -180,6 +184,11 @@ exports.defineAutoTests = function () { }); it("media.spec.16 position should be set properly", function (done) { // no audio hardware available if (!isAudioSupported) { pending(); return; } var self = this; var mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3', mediaState = Media.MEDIA_STOPPED, Loading Loading @@ -208,6 +217,11 @@ exports.defineAutoTests = function () { }); it("media.spec.17 duration should be set properly", function (done) { // no audio hardware available if (!isAudioSupported) { pending(); return; } var self = this; if (cordova.platformId === 'blackberry10') { expect(true).toFailWithMessage('Platform does not supported this feature'); Loading Loading
src/windows/MediaProxy.js +6 −2 Changes for src/windows/MediaProxy.js: 6 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -96,8 +96,12 @@ module.exports = { stopPlayingAudio:function(win, lose, args) { var id = args[0]; try { (Media.get(id)).node.pause(); (Media.get(id)).node.currentTime = 0; 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; } Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED); win(); } catch (err) { Loading
tests/tests.js +14 −0 Changes for tests/tests.js: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,10 @@ * */ var isWindows = cordova.platformId == 'windows8' || cordova.platformId == 'windows'; // detect whether audio hardware is available and enabled var isAudioSupported = isWindows ? Windows.Media.Devices.MediaDevice.getDefaultAudioRenderId(Windows.Media.Devices.AudioDeviceRole.default) : true; exports.defineAutoTests = function () { var failed = function (done, msg, error) { var info = typeof msg == 'undefined' ? 'Unexpected error callback' : msg; Loading Loading @@ -180,6 +184,11 @@ exports.defineAutoTests = function () { }); it("media.spec.16 position should be set properly", function (done) { // no audio hardware available if (!isAudioSupported) { pending(); return; } var self = this; var mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3', mediaState = Media.MEDIA_STOPPED, Loading Loading @@ -208,6 +217,11 @@ exports.defineAutoTests = function () { }); it("media.spec.17 duration should be set properly", function (done) { // no audio hardware available if (!isAudioSupported) { pending(); return; } var self = this; if (cordova.platformId === 'blackberry10') { expect(true).toFailWithMessage('Platform does not supported this feature'); Loading