fix 'moves to next segment if network error'
Showing
1 changed file
with
11 additions
and
6 deletions
... | @@ -366,13 +366,10 @@ asyncTest('selects a playlist after segment downloads', function() { | ... | @@ -366,13 +366,10 @@ asyncTest('selects a playlist after segment downloads', function() { |
366 | player.trigger('timeupdate'); | 366 | player.trigger('timeupdate'); |
367 | }); | 367 | }); |
368 | 368 | ||
369 | test('moves to the next segment if there is a network error', function() { | 369 | asyncTest('moves to the next segment if there is a network error', function() { |
370 | var mediaIndex; | 370 | var mediaIndex; |
371 | player.hls('manifest/master.m3u8'); | ||
372 | videojs.mediaSources[player.currentSrc()].trigger({ | ||
373 | type: 'sourceopen' | ||
374 | }); | ||
375 | 371 | ||
372 | player.on('loadedmanifest', function() { | ||
376 | // fail the next segment request | 373 | // fail the next segment request |
377 | window.XMLHttpRequest = function() { | 374 | window.XMLHttpRequest = function() { |
378 | this.open = function() {}; | 375 | this.open = function() {}; |
... | @@ -380,12 +377,20 @@ test('moves to the next segment if there is a network error', function() { | ... | @@ -380,12 +377,20 @@ test('moves to the next segment if there is a network error', function() { |
380 | this.readyState = 4; | 377 | this.readyState = 4; |
381 | this.status = 400; | 378 | this.status = 400; |
382 | this.onreadystatechange(); | 379 | this.onreadystatechange(); |
380 | |||
381 | strictEqual(mediaIndex + 1, player.hls.mediaIndex, 'media index is incremented'); | ||
382 | start(); | ||
383 | }; | 383 | }; |
384 | }; | 384 | }; |
385 | |||
385 | mediaIndex = player.hls.mediaIndex; | 386 | mediaIndex = player.hls.mediaIndex; |
386 | player.trigger('timeupdate'); | 387 | player.trigger('timeupdate'); |
388 | }); | ||
387 | 389 | ||
388 | strictEqual(mediaIndex + 1, player.hls.mediaIndex, 'media index is incremented'); | 390 | player.hls('manifest/master.m3u8'); |
391 | videojs.mediaSources[player.currentSrc()].trigger({ | ||
392 | type: 'sourceopen' | ||
393 | }); | ||
389 | }); | 394 | }); |
390 | 395 | ||
391 | test('updates the duration after switching playlists', function() { | 396 | test('updates the duration after switching playlists', function() { | ... | ... |
-
Please register or sign in to post a comment