81ffeb83 by David LaPalomento

Merge pull request #153 from videojs/gutworth-dispose-sb

Abort the SourceBuffer when the player is disposed.
2 parents 0337945d 6ddc7ed8
......@@ -244,6 +244,9 @@ videojs.Hls.prototype.dispose = function() {
if (this.playlists) {
this.playlists.dispose();
}
if (this.sourceBuffer) {
this.sourceBuffer.abort();
}
videojs.Flash.prototype.dispose.call(this);
};
......
......@@ -1126,6 +1126,22 @@ test('disposes the playlist loader', function() {
strictEqual(disposes, 1, 'disposed playlist loader');
});
test('aborts the source buffer on disposal', function() {
var aborts = 0, player;
player = createPlayer();
player.src({
src: 'manifest/master.m3u8',
type: 'application/vnd.apple.mpegurl'
});
openMediaSource(player);
player.hls.sourceBuffer.abort = function() {
aborts++;
};
player.dispose();
strictEqual(aborts, 1, 'aborted the source buffer');
});
test('only supports HLS MIME types', function() {
ok(videojs.Hls.canPlaySource({
type: 'aPplicatiOn/x-MPegUrl'
......@@ -1687,6 +1703,7 @@ test('treats invalid keys as a key request failure', function() {
this.appendBuffer = function(chunk) {
bytes.push(chunk);
};
this.abort = function() {};
};
player.src({
src: 'https://example.com/media.m3u8',
......