Fixup and add test for switching
Showing
1 changed file
with
34 additions
and
0 deletions
... | @@ -349,6 +349,9 @@ test('downloads media playlists after loading the master', function() { | ... | @@ -349,6 +349,9 @@ test('downloads media playlists after loading the master', function() { |
349 | openMediaSource(player); | 349 | openMediaSource(player); |
350 | 350 | ||
351 | standardXHRResponse(requests[0]); | 351 | standardXHRResponse(requests[0]); |
352 | |||
353 | // set bandwidth to a high number, so, we don't switch; | ||
354 | player.hls.bandwidth = 500000; | ||
352 | standardXHRResponse(requests[1]); | 355 | standardXHRResponse(requests[1]); |
353 | standardXHRResponse(requests[2]); | 356 | standardXHRResponse(requests[2]); |
354 | 357 | ||
... | @@ -365,6 +368,37 @@ test('downloads media playlists after loading the master', function() { | ... | @@ -365,6 +368,37 @@ test('downloads media playlists after loading the master', function() { |
365 | 'first segment requested'); | 368 | 'first segment requested'); |
366 | }); | 369 | }); |
367 | 370 | ||
371 | test('downloads a second media playlist before playback', function() { | ||
372 | player.src({ | ||
373 | src: 'manifest/master.m3u8', | ||
374 | type: 'application/vnd.apple.mpegurl' | ||
375 | }); | ||
376 | openMediaSource(player); | ||
377 | |||
378 | standardXHRResponse(requests[0]); | ||
379 | player.hls.bandwidth = 0; | ||
380 | standardXHRResponse(requests[1]); | ||
381 | standardXHRResponse(requests[2]); | ||
382 | standardXHRResponse(requests[3]); | ||
383 | |||
384 | strictEqual(requests[0].url, 'manifest/master.m3u8', 'master playlist requested'); | ||
385 | strictEqual(requests[1].url, | ||
386 | window.location.origin + | ||
387 | window.location.pathname.split('/').slice(0, -1).join('/') + | ||
388 | '/manifest/media.m3u8', | ||
389 | 'media playlist requested'); | ||
390 | strictEqual(requests[2].url, | ||
391 | window.location.origin + | ||
392 | window.location.pathname.split('/').slice(0, -1).join('/') + | ||
393 | '/manifest/media1.m3u8', | ||
394 | 'media playlist requested'); | ||
395 | strictEqual(requests[3].url, | ||
396 | window.location.origin + | ||
397 | window.location.pathname.split('/').slice(0, -1).join('/') + | ||
398 | '/manifest/00001.ts', | ||
399 | 'first segment requested'); | ||
400 | }); | ||
401 | |||
368 | test('timeupdates do not check to fill the buffer until a media playlist is ready', function() { | 402 | test('timeupdates do not check to fill the buffer until a media playlist is ready', function() { |
369 | player.src({ | 403 | player.src({ |
370 | src: 'manifest/media.m3u8', | 404 | src: 'manifest/media.m3u8', | ... | ... |
-
Please register or sign in to post a comment