A playlist loader setBandwidthByXhr. Fix a test.
Showing
2 changed files
with
9 additions
and
3 deletions
... | @@ -58,7 +58,7 @@ | ... | @@ -58,7 +58,7 @@ |
58 | haveMetadata = function(error, xhr, url) { | 58 | haveMetadata = function(error, xhr, url) { |
59 | var parser, refreshDelay, update; | 59 | var parser, refreshDelay, update; |
60 | 60 | ||
61 | loader.bandwidth = request && request.bandwidth || xhr && xhr.bandwidth; | 61 | loader.setBandwidthByXHR(request || xhr); |
62 | 62 | ||
63 | // any in-flight request is now finished | 63 | // any in-flight request is now finished |
64 | request = null; | 64 | request = null; |
... | @@ -202,6 +202,10 @@ | ... | @@ -202,6 +202,10 @@ |
202 | }); | 202 | }); |
203 | }; | 203 | }; |
204 | 204 | ||
205 | loader.setBandwidthByXHR = function(xhr) { | ||
206 | loader.bandwidth = xhr.bandwidth; | ||
207 | }; | ||
208 | |||
205 | // live playlist staleness timeout | 209 | // live playlist staleness timeout |
206 | loader.on('mediaupdatetimeout', function() { | 210 | loader.on('mediaupdatetimeout', function() { |
207 | if (loader.state !== 'HAVE_METADATA') { | 211 | if (loader.state !== 'HAVE_METADATA') { | ... | ... |
... | @@ -377,8 +377,10 @@ test('downloads a second media playlist before playback, if bandwidth is high', | ... | @@ -377,8 +377,10 @@ test('downloads a second media playlist before playback, if bandwidth is high', |
377 | 377 | ||
378 | standardXHRResponse(requests[0]); | 378 | standardXHRResponse(requests[0]); |
379 | 379 | ||
380 | player.hls.bandwidth = 0; | 380 | player.hls.playlists.setBandwidthByXHR = function() { |
381 | requests[1].requestTime = (new Date()) - 100; | 381 | player.hls.playlists.bandwidth = 100000; |
382 | }; | ||
383 | |||
382 | standardXHRResponse(requests[1]); | 384 | standardXHRResponse(requests[1]); |
383 | standardXHRResponse(requests[2]); | 385 | standardXHRResponse(requests[2]); |
384 | standardXHRResponse(requests[3]); | 386 | standardXHRResponse(requests[3]); | ... | ... |
-
Please register or sign in to post a comment