You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2020/07/04 17:43:39 UTC
[cordova-plugin-media] 01/01: fix: remove deprecated platform code
snippets
This is an automated email from the ASF dual-hosted git repository.
timbru31 pushed a commit to branch fix/remove-old-platform-code
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-media.git
commit 84f208ac9fe69605c4d59fb0255945cbdca85509
Author: Tim Brust <gi...@timbrust.de>
AuthorDate: Sat Jul 4 19:43:24 2020 +0200
fix: remove deprecated platform code snippets
---
tests/tests.js | 73 ++++++++--------------------------------------------------
www/Media.js | 6 +----
2 files changed, 10 insertions(+), 69 deletions(-)
diff --git a/tests/tests.js b/tests/tests.js
index 9639257..b2f8ebf 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -28,8 +28,7 @@ var ACTUAL_PLAYBACK_TEST_TIMEOUT = 2 * 60 * 1000;
var WEB_MP3_FILE = 'https://cordova.apache.org/downloads/BlueZedEx.mp3';
var WEB_MP3_STREAM = 'https://cordova.apache.org/downloads/BlueZedEx.mp3';
-var isWindows =
- cordova.platformId === 'windows8' || cordova.platformId === 'windows';
+var isWindows = cordova.platformId === 'windows';
var isBrowser = cordova.platformId === 'browser';
// Detect whether audio hardware is available and enabled. For iOS playing audio is
// not supported on emulators w/out sound device connected to host PC but (which is
@@ -42,10 +41,6 @@ var isAudioSupported = isWindows
? !window.SAUCELABS_ENV
: true;
-var isKitKat =
- cordova.platformId === 'android' &&
- /Android\s4\.4/.test(window.navigator.userAgent);
-
exports.defineAutoTests = function () {
var failed = function (done, msg, context) {
if (context && context.done) return;
@@ -207,11 +202,6 @@ exports.defineAutoTests = function () {
});
it('media.spec.18 should return MediaError for bad filename', function (done) {
- // bb10 dialog pops up, preventing tests from running
- if (cordova.platformId === 'blackberry10') {
- pending();
- }
-
var context = this;
var fileName = 'invalid.file.name';
var badMedia = new Media(
@@ -252,7 +242,7 @@ exports.defineAutoTests = function () {
'media.spec.19 position should be set properly',
function (done) {
// no audio hardware available
- if (!isAudioSupported || isBrowser || isKitKat) {
+ if (!isAudioSupported || isBrowser) {
pending();
}
@@ -307,12 +297,7 @@ exports.defineAutoTests = function () {
it(
'media.spec.20 duration should be set properly',
function (done) {
- if (
- !isAudioSupported ||
- cordova.platformId === 'blackberry10' ||
- isBrowser ||
- isKitKat
- ) {
+ if (!isAudioSupported || isBrowser) {
pending();
}
@@ -366,11 +351,7 @@ exports.defineAutoTests = function () {
it(
'media.spec.21 should be able to resume playback after pause',
function (done) {
- if (
- !isAudioSupported ||
- cordova.platformId === 'blackberry10' ||
- isKitKat
- ) {
+ if (!isAudioSupported) {
pending();
}
@@ -433,11 +414,7 @@ exports.defineAutoTests = function () {
it(
'media.spec.22 should be able to seek through file',
function (done) {
- if (
- !isAudioSupported ||
- cordova.platformId === 'blackberry10' ||
- isKitKat
- ) {
+ if (!isAudioSupported) {
pending();
}
@@ -570,7 +547,7 @@ exports.defineAutoTests = function () {
function (done) {
// no audio hardware available, OR
// O_o Safari can't play the stream, so we're skipping this test on all browsers o_O
- if (!isAudioSupported || isBrowser || isKitKat) {
+ if (!isAudioSupported || isBrowser) {
pending();
}
@@ -612,11 +589,6 @@ exports.defineAutoTests = function () {
);
it('media.spec.26 should not crash or throw when setting the volume right after creating the media', function (done) {
- // bb10 dialog pops up, preventing tests from running
- if (cordova.platformId === 'blackberry10') {
- pending();
- }
-
var mediaFile = WEB_MP3_FILE;
var media = null;
@@ -635,8 +607,7 @@ exports.defineAutoTests = function () {
});
it('media.spec.27 should call success or error when trying to stop a media that is in starting state', function (done) {
- // bb10 dialog pops up, preventing tests from running
- if (!isAudioSupported || cordova.platformId === 'blackberry10') {
+ if (!isAudioSupported) {
pending();
}
@@ -982,27 +953,6 @@ exports.defineManualTests = function (contentEl, createActionButton) {
);
}
- // Function to create a file for BB recording
- function getRecordSrcBB () {
- var fsFail = function (error) {
- console.log('error creating file for BB recording', error);
- };
- var gotFile = function (file) {
- recordSrc = file.fullPath;
- };
- var gotFS = function (fileSystem) {
- fileSystem.root.getFile(
- 'BBRecording.amr',
- {
- create: true
- },
- gotFile,
- fsFail
- );
- };
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fsFail);
- }
-
// Function to create a file for Windows recording
function getRecordSrcWin () {
var fsFail = function (error) {
@@ -1333,15 +1283,10 @@ exports.defineManualTests = function (contentEl, createActionButton) {
},
'setVolumeBtn'
);
- // get Special path to record if iOS || Blackberry
+ // get Special path to record if iOS
if (cordova.platformId === 'ios') {
getRecordSrc();
- } else if (cordova.platformId === 'blackberry') {
- getRecordSrcBB();
- } else if (
- cordova.platformId === 'windows' ||
- cordova.platformId === 'windows8'
- ) {
+ } else if (cordova.platformId === 'windows') {
getRecordSrcWin();
}
diff --git a/www/Media.js b/www/Media.js
index ff7af44..5e3131c 100644
--- a/www/Media.js
+++ b/www/Media.js
@@ -289,11 +289,7 @@ function onMessageFromNative (msg) {
}
}
-if (
- cordova.platformId === 'android' ||
- cordova.platformId === 'amazon-fireos' ||
- cordova.platformId === 'windowsphone'
-) {
+if (cordova.platformId === 'android') {
var channel = require('cordova/channel');
channel.createSticky('onMediaPluginReady');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org