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.
Showing
1 changed file
with
18 additions
and
0 deletions
... | @@ -1385,6 +1385,24 @@ test('live playlist starts 30s before live', function() { | ... | @@ -1385,6 +1385,24 @@ test('live playlist starts 30s before live', function() { |
1385 | strictEqual(player.hls.mediaIndex, 6, 'mediaIndex is updated after the reload'); | 1385 | strictEqual(player.hls.mediaIndex, 6, 'mediaIndex is updated after the reload'); |
1386 | }); | 1386 | }); |
1387 | 1387 | ||
1388 | test('does not reset live currentTime if mediaIndex is one beyond the last available segment', function() { | ||
1389 | var playlist = { | ||
1390 | mediaSequence: 20, | ||
1391 | targetDuration: 9, | ||
1392 | segments: [{ | ||
1393 | duration: 3 | ||
1394 | }, { | ||
1395 | duration: 3 | ||
1396 | }, { | ||
1397 | duration: 3 | ||
1398 | }] | ||
1399 | }; | ||
1400 | |||
1401 | equal(playlist.segments.length, | ||
1402 | videojs.Hls.translateMediaIndex(playlist.segments.length, playlist, playlist), | ||
1403 | 'did not change mediaIndex'); | ||
1404 | }); | ||
1405 | |||
1388 | test('live playlist starts with correct currentTime value', function() { | 1406 | test('live playlist starts with correct currentTime value', function() { |
1389 | player.src({ | 1407 | player.src({ |
1390 | src: 'http://example.com/manifest/liveStart30sBefore.m3u8', | 1408 | src: 'http://example.com/manifest/liveStart30sBefore.m3u8', | ... | ... |
-
Please register or sign in to post a comment