8d78a902 by Gary Katsevman

fix 'moves to next segment if network error'

1 parent 3bccfa73
......@@ -366,13 +366,10 @@ asyncTest('selects a playlist after segment downloads', function() {
player.trigger('timeupdate');
});
test('moves to the next segment if there is a network error', function() {
asyncTest('moves to the next segment if there is a network error', function() {
var mediaIndex;
player.hls('manifest/master.m3u8');
videojs.mediaSources[player.currentSrc()].trigger({
type: 'sourceopen'
});
player.on('loadedmanifest', function() {
// fail the next segment request
window.XMLHttpRequest = function() {
this.open = function() {};
......@@ -380,12 +377,20 @@ test('moves to the next segment if there is a network error', function() {
this.readyState = 4;
this.status = 400;
this.onreadystatechange();
strictEqual(mediaIndex + 1, player.hls.mediaIndex, 'media index is incremented');
start();
};
};
mediaIndex = player.hls.mediaIndex;
player.trigger('timeupdate');
});
strictEqual(mediaIndex + 1, player.hls.mediaIndex, 'media index is incremented');
player.hls('manifest/master.m3u8');
videojs.mediaSources[player.currentSrc()].trigger({
type: 'sourceopen'
});
});
test('updates the duration after switching playlists', function() {
......