376faee0 by David LaPalomento

Test that mediaIndex isn't reset for live unnecessarily

If mediaIndex was one position beyond the last segment because the player was waiting for a playlist update, it would be reset back to the "live" point. This test checks that the utility translation function does not change mediaIndex in that case.
1 parent 31ee4d9c
......@@ -1385,6 +1385,24 @@ test('live playlist starts 30s before live', function() {
strictEqual(player.hls.mediaIndex, 6, 'mediaIndex is updated after the reload');
});
test('does not reset live currentTime if mediaIndex is one beyond the last available segment', function() {
var playlist = {
mediaSequence: 20,
targetDuration: 9,
segments: [{
duration: 3
}, {
duration: 3
}, {
duration: 3
}]
};
equal(playlist.segments.length,
videojs.Hls.translateMediaIndex(playlist.segments.length, playlist, playlist),
'did not change mediaIndex');
});
test('live playlist starts with correct currentTime value', function() {
player.src({
src: 'http://example.com/manifest/liveStart30sBefore.m3u8',
......