diff --git a/test/master-playlist-controller.test.js b/test/master-playlist-controller.test.js index ae4e69898..68efb8553 100644 --- a/test/master-playlist-controller.test.js +++ b/test/master-playlist-controller.test.js @@ -5839,6 +5839,10 @@ QUnit.test('maxPlaylistRetries defaults to Infinity when no value or null/undefi assert.equal(playerNull.tech_.vhs.masterPlaylistController_.maxPlaylistRetries, Infinity, 'maxPlaylistRetries defaults to Infinity when null is provided as the option value'); assert.equal(playerUndefined.tech_.vhs.masterPlaylistController_.maxPlaylistRetries, Infinity, 'maxPlaylistRetries defaults to Infinity when undefined is provided as the option value'); assert.equal(playerNoValue.tech_.vhs.masterPlaylistController_.maxPlaylistRetries, Infinity, 'maxPlaylistRetries defaults to Infinity when no value is provided'); + + playerNoValue.dispose(); + playerUndefined.dispose(); + playerNull.dispose(); }); QUnit.test('maxPlaylistRetries is set when zero is passed as the option\'s value', function(assert) { @@ -5858,6 +5862,8 @@ QUnit.test('maxPlaylistRetries is set when zero is passed as the option\'s value this.clock.tick(1); assert.equal(player.tech_.vhs.masterPlaylistController_.maxPlaylistRetries, 0, 'maxPlaylistRetries was set to zero'); + + player.dispose(); }); QUnit.test('true duration < 16 with experimentalBufferBasedABR', function(assert) { diff --git a/test/media-segment-request.test.js b/test/media-segment-request.test.js index 92f6344a7..4ca5c1a81 100644 --- a/test/media-segment-request.test.js +++ b/test/media-segment-request.test.js @@ -62,20 +62,25 @@ const sharedHooks = { this.clock.tick(1); }; + this.transmuxers = []; this.createTransmuxer = () => { - return createTransmuxer_({ + const transmuxer = createTransmuxer_({ remux: false, keepOriginalTimestamps: true }); + + this.transmuxers.push(transmuxer); + + return transmuxer; }; }, afterEach(assert) { this.realDecrypter.terminate(); this.env.restore(); - if (this.transmuxer) { - this.transmuxer.terminate(); - } + this.transmuxers.forEach(function(transmuxer) { + transmuxer.terminate(); + }); } }; @@ -108,10 +113,7 @@ QUnit.module('Media Segment Request - make it to transmuxer', { }); }, - afterEach(assert) { - this.transmuxer = this.options.segment.transmuxer; - sharedHooks.afterEach.call(this, assert); - } + afterEach: sharedHooks.afterEach }); QUnit.test('ac3 without id3 segments will not make it to the transmuxer', function(assert) { @@ -712,8 +714,7 @@ QUnit.test('key 500 calls back with error', function(assert) { QUnit.test('init segment with key has bytes decrypted', function(assert) { const done = assert.async(); const postMessage = this.mockDecrypter.postMessage; - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); // mock decrypting the init segment. this.mockDecrypter.postMessage = (message) => { @@ -732,7 +733,7 @@ QUnit.test('init segment with key has bytes decrypted', function(assert) { xhrOptions: this.xhrOptions, decryptionWorker: this.mockDecrypter, segment: { - transmuxer: this.transmuxer, + transmuxer, resolvedUri: '0-test.mp4', map: { resolvedUri: '0-map.mp4', @@ -799,8 +800,7 @@ QUnit.test('init segment with key has bytes decrypted', function(assert) { QUnit.test('segment/init segment share a key and get decrypted', function(assert) { const done = assert.async(); const postMessage = this.mockDecrypter.postMessage; - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); // mock decrypting the init segment. this.mockDecrypter.postMessage = (message) => { @@ -824,7 +824,7 @@ QUnit.test('segment/init segment share a key and get decrypted', function(assert xhrOptions: this.xhrOptions, decryptionWorker: this.mockDecrypter, segment: { - transmuxer: this.transmuxer, + transmuxer, resolvedUri: '0-test.mp4', key: { resolvedUri: '0-key.php', @@ -906,8 +906,7 @@ QUnit.test('segment/init segment share a key and get decrypted', function(assert QUnit.test('segment/init segment different key and get decrypted', function(assert) { const done = assert.async(); const postMessage = this.mockDecrypter.postMessage; - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); // mock decrypting the init segment. this.mockDecrypter.postMessage = (message) => { @@ -931,7 +930,7 @@ QUnit.test('segment/init segment different key and get decrypted', function(asse xhrOptions: this.xhrOptions, decryptionWorker: this.mockDecrypter, segment: { - transmuxer: this.transmuxer, + transmuxer, resolvedUri: '0-test.mp4', key: { resolvedUri: '0-key.php', @@ -1017,8 +1016,7 @@ QUnit.test('segment/init segment different key and get decrypted', function(asse QUnit.test('encrypted init segment parse error', function(assert) { const done = assert.async(); const postMessage = this.mockDecrypter.postMessage; - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); // mock decrypting the init segment. this.mockDecrypter.postMessage = (message) => { @@ -1041,7 +1039,7 @@ QUnit.test('encrypted init segment parse error', function(assert) { xhrOptions: this.xhrOptions, decryptionWorker: this.mockDecrypter, segment: { - transmuxer: this.transmuxer, + transmuxer, resolvedUri: '0-test.mp4', key: { resolvedUri: '0-key.php', @@ -1097,15 +1095,14 @@ QUnit.test('encrypted init segment parse error', function(assert) { QUnit.test('encrypted init segment request failure', function(assert) { const done = assert.async(); - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); mediaSegmentRequest({ xhr: this.xhr, xhrOptions: this.xhrOptions, decryptionWorker: this.mockDecrypter, segment: { - transmuxer: this.transmuxer, + transmuxer, resolvedUri: '0-test.mp4', key: { resolvedUri: '0-key.php', @@ -1159,8 +1156,7 @@ QUnit.test('encrypted init segment request failure', function(assert) { QUnit.test('encrypted init segment with decrypted bytes not re-requested', function(assert) { const done = assert.async(); const postMessage = this.mockDecrypter.postMessage; - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); // mock decrypting the init segment. this.mockDecrypter.postMessage = (message) => { @@ -1179,7 +1175,7 @@ QUnit.test('encrypted init segment with decrypted bytes not re-requested', funct xhrOptions: this.xhrOptions, decryptionWorker: this.mockDecrypter, segment: { - transmuxer: this.transmuxer, + transmuxer, resolvedUri: '0-test.mp4', key: { resolvedUri: '0-key.php', @@ -1261,8 +1257,7 @@ QUnit.test( 'waits for every request to finish before the callback is run', function(assert) { const done = assert.async(); - - this.transmuxer = this.createTransmuxer(); + const transmuxer = this.createTransmuxer(); assert.expect(10); mediaSegmentRequest({ @@ -1280,7 +1275,7 @@ QUnit.test( map: { resolvedUri: '0-init.dat' }, - transmuxer: this.transmuxer + transmuxer }, progressFn: this.noop, trackInfoFn: this.noop, @@ -1326,7 +1321,6 @@ QUnit.test('non-TS segment will get parsed for captions', function(assert) { let gotCaption = false; let gotData = false; const captions = [{foo: 'bar'}]; - const transmuxer = new videojs.EventTarget(); transmuxer.postMessage = (event) => {