Add a live testcase for the manual buffer culling system
Showing
1 changed file
with
44 additions
and
2 deletions
... | @@ -373,7 +373,50 @@ test('duration is set when the source opens after the playlist is loaded', funct | ... | @@ -373,7 +373,50 @@ test('duration is set when the source opens after the playlist is loaded', funct |
373 | equal(player.tech_.hls.mediaSource.duration , 40, 'set the duration'); | 373 | equal(player.tech_.hls.mediaSource.duration , 40, 'set the duration'); |
374 | }); | 374 | }); |
375 | 375 | ||
376 | test('calls `remove` on sourceBuffer to when loading a segment', function() { | 376 | test('calls `remove` on sourceBuffer to when loading a live segment', function() { |
377 | var | ||
378 | removes = [], | ||
379 | seekable = videojs.createTimeRanges([[60, 120]]); | ||
380 | |||
381 | player.src({ | ||
382 | src: 'liveStart30sBefore.m3u8', | ||
383 | type: 'application/vnd.apple.mpegurl' | ||
384 | }); | ||
385 | openMediaSource(player); | ||
386 | player.tech_.hls.seekable = function(){ | ||
387 | return seekable; | ||
388 | }; | ||
389 | |||
390 | openMediaSource(player); | ||
391 | player.tech_.hls.mediaSource.addSourceBuffer = function() { | ||
392 | return new (videojs.extend(videojs.EventTarget, { | ||
393 | constructor: function() {}, | ||
394 | abort: function() {}, | ||
395 | buffered: videojs.createTimeRange(), | ||
396 | appendBuffer: function() {}, | ||
397 | remove: function(start, end) { | ||
398 | removes.push([start, end]); | ||
399 | } | ||
400 | }))(); | ||
401 | }; | ||
402 | player.tech_.hls.bandwidth = 20e10; | ||
403 | player.tech_.triggerReady(); | ||
404 | standardXHRResponse(requests[0]); | ||
405 | |||
406 | player.tech_.hls.playlists.trigger('loadedmetadata'); | ||
407 | player.tech_.trigger('canplay'); | ||
408 | player.tech_.paused = function() { return false; }; | ||
409 | player.tech_.trigger('play'); | ||
410 | |||
411 | clock.tick(1); | ||
412 | standardXHRResponse(requests[1]); | ||
413 | |||
414 | strictEqual(requests[0].url, 'liveStart30sBefore.m3u8', 'master playlist requested'); | ||
415 | equal(removes.length, 1, 'remove called'); | ||
416 | deepEqual(removes[0], [0, seekable.start(0)], 'remove called with the right range'); | ||
417 | }); | ||
418 | |||
419 | test('calls `remove` on sourceBuffer to when loading a vod segment', function() { | ||
377 | var removes = []; | 420 | var removes = []; |
378 | player.src({ | 421 | player.src({ |
379 | src: 'manifest/master.m3u8', | 422 | src: 'manifest/master.m3u8', |
... | @@ -405,7 +448,6 @@ test('calls `remove` on sourceBuffer to when loading a segment', function() { | ... | @@ -405,7 +448,6 @@ test('calls `remove` on sourceBuffer to when loading a segment', function() { |
405 | deepEqual(removes[0], [0, 120 - 60], 'remove called with the right range'); | 448 | deepEqual(removes[0], [0, 120 - 60], 'remove called with the right range'); |
406 | }); | 449 | }); |
407 | 450 | ||
408 | |||
409 | test('codecs are passed to the source buffer', function() { | 451 | test('codecs are passed to the source buffer', function() { |
410 | var codecs = []; | 452 | var codecs = []; |
411 | player.src({ | 453 | player.src({ | ... | ... |
-
Please register or sign in to post a comment