Add test for abort in dispose()
When the player is disposed, we should abort the SourceBuffer.
Showing
1 changed file
with
17 additions
and
0 deletions
... | @@ -1126,6 +1126,22 @@ test('disposes the playlist loader', function() { | ... | @@ -1126,6 +1126,22 @@ test('disposes the playlist loader', function() { |
1126 | strictEqual(disposes, 1, 'disposed playlist loader'); | 1126 | strictEqual(disposes, 1, 'disposed playlist loader'); |
1127 | }); | 1127 | }); |
1128 | 1128 | ||
1129 | test('aborts the source buffer on disposal', function() { | ||
1130 | var aborts = 0, player; | ||
1131 | player = createPlayer(); | ||
1132 | player.src({ | ||
1133 | src: 'manifest/master.m3u8', | ||
1134 | type: 'application/vnd.apple.mpegurl' | ||
1135 | }); | ||
1136 | openMediaSource(player); | ||
1137 | player.hls.sourceBuffer.abort = function() { | ||
1138 | aborts++; | ||
1139 | }; | ||
1140 | |||
1141 | player.dispose(); | ||
1142 | strictEqual(aborts, 1, 'aborted the source buffer'); | ||
1143 | }); | ||
1144 | |||
1129 | test('only supports HLS MIME types', function() { | 1145 | test('only supports HLS MIME types', function() { |
1130 | ok(videojs.Hls.canPlaySource({ | 1146 | ok(videojs.Hls.canPlaySource({ |
1131 | type: 'aPplicatiOn/x-MPegUrl' | 1147 | type: 'aPplicatiOn/x-MPegUrl' |
... | @@ -1687,6 +1703,7 @@ test('treats invalid keys as a key request failure', function() { | ... | @@ -1687,6 +1703,7 @@ test('treats invalid keys as a key request failure', function() { |
1687 | this.appendBuffer = function(chunk) { | 1703 | this.appendBuffer = function(chunk) { |
1688 | bytes.push(chunk); | 1704 | bytes.push(chunk); |
1689 | }; | 1705 | }; |
1706 | this.abort = function() {}; | ||
1690 | }; | 1707 | }; |
1691 | player.src({ | 1708 | player.src({ |
1692 | src: 'https://example.com/media.m3u8', | 1709 | src: 'https://example.com/media.m3u8', | ... | ... |
-
Please register or sign in to post a comment