Revert "fix 'selects a playlist after segment downloads'"
This reverts commit 3bccfa73.
Showing
1 changed file
with
3 additions
and
31 deletions
... | @@ -316,47 +316,18 @@ test('calculates the bandwidth after downloading a segment', function() { | ... | @@ -316,47 +316,18 @@ test('calculates the bandwidth after downloading a segment', function() { |
316 | 'saves segment request time: ' + player.hls.segmentXhrTime + 's'); | 316 | 'saves segment request time: ' + player.hls.segmentXhrTime + 's'); |
317 | }); | 317 | }); |
318 | 318 | ||
319 | asyncTest('selects a playlist after segment downloads', function() { | 319 | test('selects a playlist after segment downloads', function() { |
320 | window.XMLHttpRequest = function() { | ||
321 | this.open = function(method, url) { | ||
322 | xhrUrls.push(url); | ||
323 | }; | ||
324 | this.send = function() { | ||
325 | var self = this; | ||
326 | setTimeout(function() { | ||
327 | var manifestName = (/(?:.*\/)?(.*)\.m3u8/).exec(xhrUrls.slice(-1)[0]); | ||
328 | if (manifestName) { | ||
329 | manifestName = manifestName[1]; | ||
330 | } | ||
331 | self.responseText = window.manifests[manifestName || xhrUrls.slice(-1)[0]]; | ||
332 | self.response = new Uint8Array([1]).buffer; | ||
333 | |||
334 | self.readyState = 4; | ||
335 | self.onreadystatechange(); | ||
336 | }, 0); | ||
337 | }; | ||
338 | this.abort = function() {}; | ||
339 | }; | ||
340 | |||
341 | var calls = 0; | 320 | var calls = 0; |
342 | player.hls('manifest/master.m3u8'); | 321 | player.hls('manifest/master.m3u8'); |
343 | player.hls.selectPlaylist = function() { | 322 | player.hls.selectPlaylist = function() { |
344 | calls++; | 323 | calls++; |
345 | strictEqual(calls, 1, 'selects after the initial segment'); | ||
346 | |||
347 | player.hls.selectPlaylist = function() { | ||
348 | calls++; | ||
349 | strictEqual(calls, 2, 'selects after additional segments'); | ||
350 | start(); | ||
351 | return player.hls.master.playlists[0]; | ||
352 | }; | ||
353 | |||
354 | return player.hls.master.playlists[0]; | 324 | return player.hls.master.playlists[0]; |
355 | }; | 325 | }; |
356 | videojs.mediaSources[player.currentSrc()].trigger({ | 326 | videojs.mediaSources[player.currentSrc()].trigger({ |
357 | type: 'sourceopen' | 327 | type: 'sourceopen' |
358 | }); | 328 | }); |
359 | 329 | ||
330 | strictEqual(calls, 1, 'selects after the initial segment'); | ||
360 | player.currentTime = function() { | 331 | player.currentTime = function() { |
361 | return 1; | 332 | return 1; |
362 | }; | 333 | }; |
... | @@ -364,6 +335,7 @@ asyncTest('selects a playlist after segment downloads', function() { | ... | @@ -364,6 +335,7 @@ asyncTest('selects a playlist after segment downloads', function() { |
364 | return videojs.createTimeRange(0, 2); | 335 | return videojs.createTimeRange(0, 2); |
365 | }; | 336 | }; |
366 | player.trigger('timeupdate'); | 337 | player.trigger('timeupdate'); |
338 | strictEqual(calls, 2, 'selects after additional segments'); | ||
367 | }); | 339 | }); |
368 | 340 | ||
369 | asyncTest('moves to the next segment if there is a network error', function() { | 341 | asyncTest('moves to the next segment if there is a network error', function() { | ... | ... |
-
Please register or sign in to post a comment