5e255431 by Gary Katsevman

A playlist loader setBandwidthByXhr. Fix a test.

1 parent 45749f62
......@@ -58,7 +58,7 @@
haveMetadata = function(error, xhr, url) {
var parser, refreshDelay, update;
loader.bandwidth = request && request.bandwidth || xhr && xhr.bandwidth;
loader.setBandwidthByXHR(request || xhr);
// any in-flight request is now finished
request = null;
......@@ -202,6 +202,10 @@
});
};
loader.setBandwidthByXHR = function(xhr) {
loader.bandwidth = xhr.bandwidth;
};
// live playlist staleness timeout
loader.on('mediaupdatetimeout', function() {
if (loader.state !== 'HAVE_METADATA') {
......
......@@ -377,8 +377,10 @@ test('downloads a second media playlist before playback, if bandwidth is high',
standardXHRResponse(requests[0]);
player.hls.bandwidth = 0;
requests[1].requestTime = (new Date()) - 100;
player.hls.playlists.setBandwidthByXHR = function() {
player.hls.playlists.bandwidth = 100000;
};
standardXHRResponse(requests[1]);
standardXHRResponse(requests[2]);
standardXHRResponse(requests[3]);
......