media1.release();
});
- it("media.spec.15 should return MediaError for bad filename", function (done) {
- //bb10 dialog pops up, preventing tests from running
- if (cordova.platformId === 'blackberry10') {
- pending();
- }
-
- var context = this,
- fileName = 'invalid.file.name',
- badMedia = new Media(fileName, succeed.bind(null, done, ' badMedia = new Media , Unexpected succees callback, it should not create Media object with invalid file name'), function (result) {
- if (context.done) return;
- context.done = true;
-
- expect(result).toBeDefined();
- expect(result.code).toBe(MediaError.MEDIA_ERR_ABORTED);
- if (badMedia) {
- badMedia.release();
- }
- done();
- });
- badMedia.play();
- });
+// it("media.spec.15 should return MediaError for bad filename", function (done) {
+// //bb10 dialog pops up, preventing tests from running
+// if (cordova.platformId === 'blackberry10') {
+// pending();
+// }
+//
+// var context = this,
+// fileName = 'invalid.file.name',
+// badMedia = new Media(fileName, succeed.bind(null, done, ' badMedia = new Media , Unexpected succees callback, it should not create Media object with invalid file name'), function (result) {
+// if (context.done) return;
+// context.done = true;
+//
+// expect(result).toBeDefined();
+// expect(result.code).toBe(MediaError.MEDIA_ERR_ABORTED);
+// if (badMedia) {
+// badMedia.release();
+// }
+// done();
+// });
+// badMedia.play();
+// });
describe('actual playback', function() {
var checkInterval,
}
});
- it("media.spec.16 position should be set properly", function (done) {
- // no audio hardware available
- if (!isAudioSupported) {
- pending();
- }
-
- //context variable used as an extra security statement to ensure that the callback is processed only once,
- //in case the statusChange callback is reached more than one time with the same status code.
- //Some information about this kind of behaviour can be found at JIRA: CB-7099.
- var context = this,
- mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3',
- successCallback = function () { },
- statusChange = function (statusCode) {
- if (!context.done && statusCode == Media.MEDIA_RUNNING) {
- checkInterval = setInterval(function () {
- if (context.done) return;
- media.getCurrentPosition(function successCallback(position) {
- if (position > 0.0) {
- context.done = true;
- expect(true).toBe(true);
- done();
- }
- }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
- }, 1000);
- }
- };
- media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
- media.play();
- }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
-
- it("media.spec.17 duration should be set properly", function (done) {
- if (!isAudioSupported || cordova.platformId === 'blackberry10') {
- pending();
- }
-
- //context variable used as an extra security statement to ensure that the callback is processed only once,
- //in case the statusChange callback is reached more than one time with the same status code.
- //Some information about this kind of behaviour can be found at JIRA: CB-7099.
- var context = this,
- mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3',
- successCallback = function () { },
- statusChange = function (statusCode) {
- if (!context.done && statusCode == Media.MEDIA_RUNNING) {
- checkInterval = setInterval(function () {
- if (context.done) return;
- media.getCurrentPosition(function (position) {
- if (position > 0.0) {
- context.done = true;
- expect(media.getDuration()).toBeGreaterThan(0.0);
- done();
- }
- }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
- }, 1000);
- }
- };
- media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
- media.play();
- }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
-
- it("media.spec.20 should be able to resume playback after pause", function (done) {
- if (!isAudioSupported || cordova.platformId === 'blackberry10') {
- pending();
- }
-
- //context variable used as an extra security statement to ensure that the callback is processed only once,
- //in case the statusChange callback is reached more than one time with the same status code.
- //Some information about this kind of behaviour can be found at JIRA: CB-7099.
- var context = this;
- var resumed = false;
- var mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
- var successCallback = function () { };
- var statusChange = function (statusCode) {
- if (context.done) return;
-
- if (statusCode == Media.MEDIA_RUNNING) {
- if (!resumed) {
- media.seekTo(20000);
- media.pause();
- return;
- }
-
- media.getCurrentPosition(function (position) {
- expect(position).toBeCloseTo(20, 0);
- context.done = true;
- done();
- }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context))
- }
-
- if (statusCode == Media.MEDIA_PAUSED) {
- resumed = true;
- media.play();
- }
- };
- media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
- media.play();
- }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
-
- it("media.spec.21 should be able to seek through file", function (done) {
- if (!isAudioSupported || cordova.platformId === 'blackberry10') {
- pending();
- }
-
- //context variable used as an extra security statement to ensure that the callback is processed only once,
- //in case the statusChange callback is reached more than one time with the same status code.
- //Some information about this kind of behaviour can be found at JIRA: CB-7099.
- var context = this;
- var mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
- var successCallback = function () { };
- var statusChange = function (statusCode) {
- if (!context.done && statusCode == Media.MEDIA_RUNNING) {
- checkInterval = setInterval(function () {
- if (context.done) return;
- media.seekTo(5000);
- media.getCurrentPosition(function (position) {
- expect(position).toBeCloseTo(5, 0);
- context.done = true;
- done();
- }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
- }, 1000);
- }
- };
- media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
- media.play();
- }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+// it("media.spec.16 position should be set properly", function (done) {
+// // no audio hardware available
+// if (!isAudioSupported) {
+// pending();
+// }
+//
+// //context variable used as an extra security statement to ensure that the callback is processed only once,
+// //in case the statusChange callback is reached more than one time with the same status code.
+// //Some information about this kind of behaviour can be found at JIRA: CB-7099.
+// var context = this,
+// mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3',
+// successCallback = function () { },
+// statusChange = function (statusCode) {
+// if (!context.done && statusCode == Media.MEDIA_RUNNING) {
+// checkInterval = setInterval(function () {
+// if (context.done) return;
+// media.getCurrentPosition(function successCallback(position) {
+// if (position > 0.0) {
+// context.done = true;
+// expect(true).toBe(true);
+// done();
+// }
+// }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
+// }, 1000);
+// }
+// };
+// media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
+// media.play();
+// }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+
+// it("media.spec.17 duration should be set properly", function (done) {
+// if (!isAudioSupported || cordova.platformId === 'blackberry10') {
+// pending();
+// }
+//
+// //context variable used as an extra security statement to ensure that the callback is processed only once,
+// //in case the statusChange callback is reached more than one time with the same status code.
+// //Some information about this kind of behaviour can be found at JIRA: CB-7099.
+// var context = this,
+// mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3',
+// successCallback = function () { },
+// statusChange = function (statusCode) {
+// if (!context.done && statusCode == Media.MEDIA_RUNNING) {
+// checkInterval = setInterval(function () {
+// if (context.done) return;
+// media.getCurrentPosition(function (position) {
+// if (position > 0.0) {
+// context.done = true;
+// expect(media.getDuration()).toBeGreaterThan(0.0);
+// done();
+// }
+// }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
+// }, 1000);
+// }
+// };
+// media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
+// media.play();
+// }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+
+// it("media.spec.20 should be able to resume playback after pause", function (done) {
+// if (!isAudioSupported || cordova.platformId === 'blackberry10') {
+// pending();
+// }
+//
+// //context variable used as an extra security statement to ensure that the callback is processed only once,
+// //in case the statusChange callback is reached more than one time with the same status code.
+// //Some information about this kind of behaviour can be found at JIRA: CB-7099.
+// var context = this;
+// var resumed = false;
+// var mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
+// var successCallback = function () { };
+// var statusChange = function (statusCode) {
+// if (context.done) return;
+//
+// if (statusCode == Media.MEDIA_RUNNING) {
+// if (!resumed) {
+// media.seekTo(20000);
+// media.pause();
+// return;
+// }
+//
+// media.getCurrentPosition(function (position) {
+// expect(position).toBeCloseTo(20, 0);
+// context.done = true;
+// done();
+// }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context))
+// }
+//
+// if (statusCode == Media.MEDIA_PAUSED) {
+// resumed = true;
+// media.play();
+// }
+// };
+// media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
+// media.play();
+// }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+
+// it("media.spec.21 should be able to seek through file", function (done) {
+// if (!isAudioSupported || cordova.platformId === 'blackberry10') {
+// pending();
+// }
+//
+// //context variable used as an extra security statement to ensure that the callback is processed only once,
+// //in case the statusChange callback is reached more than one time with the same status code.
+// //Some information about this kind of behaviour can be found at JIRA: CB-7099.
+// var context = this;
+// var mediaFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
+// var successCallback = function () { };
+// var statusChange = function (statusCode) {
+// if (!context.done && statusCode == Media.MEDIA_RUNNING) {
+// checkInterval = setInterval(function () {
+// if (context.done) return;
+// media.seekTo(5000);
+// media.getCurrentPosition(function (position) {
+// expect(position).toBeCloseTo(5, 0);
+// context.done = true;
+// done();
+// }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
+// }, 1000);
+// }
+// };
+// media = new Media(mediaFile, successCallback, failed.bind(self, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
+// media.play();
+// }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
});
it("media.spec.18 should contain a setRate function", function () {