Fix tests to work with latest changes to videojs 5
player.tech was renamed to player.tech_ the videojs.xhr must be replaced with sinon differently now since videojs.xhr holds onto a reference to window.XMLHttpRequest
Showing
2 changed files
with
266 additions
and
260 deletions
... | @@ -20,6 +20,8 @@ | ... | @@ -20,6 +20,8 @@ |
20 | setup: function() { | 20 | setup: function() { |
21 | // fake XHRs | 21 | // fake XHRs |
22 | sinonXhr = sinon.useFakeXMLHttpRequest(); | 22 | sinonXhr = sinon.useFakeXMLHttpRequest(); |
23 | videojs.xhr.XMLHttpRequest = sinonXhr; | ||
24 | |||
23 | requests = []; | 25 | requests = []; |
24 | sinonXhr.onCreate = function(xhr) { | 26 | sinonXhr.onCreate = function(xhr) { |
25 | // force the XHR2 timeout polyfill | 27 | // force the XHR2 timeout polyfill |
... | @@ -32,6 +34,7 @@ | ... | @@ -32,6 +34,7 @@ |
32 | }, | 34 | }, |
33 | teardown: function() { | 35 | teardown: function() { |
34 | sinonXhr.restore(); | 36 | sinonXhr.restore(); |
37 | videojs.xhr.XMLHttpRequest = window.XMLHttpRequest; | ||
35 | clock.restore(); | 38 | clock.restore(); |
36 | } | 39 | } |
37 | }); | 40 | }); | ... | ... |
... | @@ -87,24 +87,24 @@ var | ... | @@ -87,24 +87,24 @@ var |
87 | player.buffered = function() { | 87 | player.buffered = function() { |
88 | return videojs.createTimeRange(0, 0); | 88 | return videojs.createTimeRange(0, 0); |
89 | }; | 89 | }; |
90 | mockTech(player.tech); | 90 | mockTech(player.tech_); |
91 | 91 | ||
92 | return player; | 92 | return player; |
93 | }, | 93 | }, |
94 | openMediaSource = function(player) { | 94 | openMediaSource = function(player) { |
95 | // ensure the Flash tech is ready | 95 | // ensure the Flash tech is ready |
96 | player.tech.triggerReady(); | 96 | player.tech_.triggerReady(); |
97 | clock.tick(1); | 97 | clock.tick(1); |
98 | 98 | ||
99 | // simulate the sourceopen event | 99 | // simulate the sourceopen event |
100 | player.tech.hls.mediaSource.readyState = 'open'; | 100 | player.tech_.hls.mediaSource.readyState = 'open'; |
101 | player.tech.hls.mediaSource.dispatchEvent({ | 101 | player.tech_.hls.mediaSource.dispatchEvent({ |
102 | type: 'sourceopen', | 102 | type: 'sourceopen', |
103 | swfId: player.tech.el().id | 103 | swfId: player.tech_.el().id |
104 | }); | 104 | }); |
105 | 105 | ||
106 | // endOfStream triggers an exception if flash isn't available | 106 | // endOfStream triggers an exception if flash isn't available |
107 | player.tech.hls.mediaSource.endOfStream = function(error) { | 107 | player.tech_.hls.mediaSource.endOfStream = function(error) { |
108 | this.error_ = error; | 108 | this.error_ = error; |
109 | }; | 109 | }; |
110 | }, | 110 | }, |
... | @@ -287,6 +287,7 @@ module('HLS', { | ... | @@ -287,6 +287,7 @@ module('HLS', { |
287 | 287 | ||
288 | // fake XHRs | 288 | // fake XHRs |
289 | xhr = sinon.useFakeXMLHttpRequest(); | 289 | xhr = sinon.useFakeXMLHttpRequest(); |
290 | videojs.xhr.XMLHttpRequest = xhr; | ||
290 | requests = []; | 291 | requests = []; |
291 | xhr.onCreate = function(xhr) { | 292 | xhr.onCreate = function(xhr) { |
292 | requests.push(xhr); | 293 | requests.push(xhr); |
... | @@ -314,6 +315,7 @@ module('HLS', { | ... | @@ -314,6 +315,7 @@ module('HLS', { |
314 | 315 | ||
315 | player.dispose(); | 316 | player.dispose(); |
316 | xhr.restore(); | 317 | xhr.restore(); |
318 | videojs.xhr.XMLHttpRequest = window.XMLHttpRequest; | ||
317 | clock.restore(); | 319 | clock.restore(); |
318 | } | 320 | } |
319 | }); | 321 | }); |
... | @@ -326,10 +328,10 @@ test('starts playing if autoplay is specified', function() { | ... | @@ -326,10 +328,10 @@ test('starts playing if autoplay is specified', function() { |
326 | type: 'application/vnd.apple.mpegurl' | 328 | type: 'application/vnd.apple.mpegurl' |
327 | }); | 329 | }); |
328 | // REMOVEME workaround https://github.com/videojs/video.js/issues/2326 | 330 | // REMOVEME workaround https://github.com/videojs/video.js/issues/2326 |
329 | player.tech.triggerReady(); | 331 | player.tech_.triggerReady(); |
330 | clock.tick(1); | 332 | clock.tick(1); |
331 | // make sure play() is called *after* the media source opens | 333 | // make sure play() is called *after* the media source opens |
332 | player.tech.hls.play = function() { | 334 | player.tech_.hls.play = function() { |
333 | plays++; | 335 | plays++; |
334 | }; | 336 | }; |
335 | openMediaSource(player); | 337 | openMediaSource(player); |
... | @@ -365,7 +367,7 @@ test('autoplay seeks to the live point after media source open', function() { | ... | @@ -365,7 +367,7 @@ test('autoplay seeks to the live point after media source open', function() { |
365 | src: 'liveStart30sBefore.m3u8', | 367 | src: 'liveStart30sBefore.m3u8', |
366 | type: 'application/vnd.apple.mpegurl' | 368 | type: 'application/vnd.apple.mpegurl' |
367 | }); | 369 | }); |
368 | player.tech.triggerReady(); | 370 | player.tech_.triggerReady(); |
369 | clock.tick(1); | 371 | clock.tick(1); |
370 | standardXHRResponse(requests.shift()); | 372 | standardXHRResponse(requests.shift()); |
371 | openMediaSource(player); | 373 | openMediaSource(player); |
... | @@ -379,12 +381,12 @@ test('duration is set when the source opens after the playlist is loaded', funct | ... | @@ -379,12 +381,12 @@ test('duration is set when the source opens after the playlist is loaded', funct |
379 | src: 'media.m3u8', | 381 | src: 'media.m3u8', |
380 | type: 'application/vnd.apple.mpegurl' | 382 | type: 'application/vnd.apple.mpegurl' |
381 | }); | 383 | }); |
382 | player.tech.triggerReady(); | 384 | player.tech_.triggerReady(); |
383 | clock.tick(1); | 385 | clock.tick(1); |
384 | standardXHRResponse(requests.shift()); | 386 | standardXHRResponse(requests.shift()); |
385 | openMediaSource(player); | 387 | openMediaSource(player); |
386 | 388 | ||
387 | equal(player.tech.hls.mediaSource.duration , 40, 'set the duration'); | 389 | equal(player.tech_.hls.mediaSource.duration , 40, 'set the duration'); |
388 | }); | 390 | }); |
389 | 391 | ||
390 | test('codecs are passed to the source buffer', function() { | 392 | test('codecs are passed to the source buffer', function() { |
... | @@ -394,7 +396,7 @@ test('codecs are passed to the source buffer', function() { | ... | @@ -394,7 +396,7 @@ test('codecs are passed to the source buffer', function() { |
394 | type: 'application/vnd.apple.mpegurl' | 396 | type: 'application/vnd.apple.mpegurl' |
395 | }); | 397 | }); |
396 | openMediaSource(player); | 398 | openMediaSource(player); |
397 | player.tech.hls.mediaSource.addSourceBuffer = function(codec) { | 399 | player.tech_.hls.mediaSource.addSourceBuffer = function(codec) { |
398 | codecs.push(codec); | 400 | codecs.push(codec); |
399 | }; | 401 | }; |
400 | 402 | ||
... | @@ -420,7 +422,7 @@ test('creates a PlaylistLoader on init', function() { | ... | @@ -420,7 +422,7 @@ test('creates a PlaylistLoader on init', function() { |
420 | src: 'manifest/playlist.m3u8', | 422 | src: 'manifest/playlist.m3u8', |
421 | type: 'application/vnd.apple.mpegurl' | 423 | type: 'application/vnd.apple.mpegurl' |
422 | }); | 424 | }); |
423 | 425 | openMediaSource(player); | |
424 | player.src({ | 426 | player.src({ |
425 | src:'manifest/playlist.m3u8', | 427 | src:'manifest/playlist.m3u8', |
426 | type: 'application/vnd.apple.mpegurl' | 428 | type: 'application/vnd.apple.mpegurl' |
... | @@ -429,11 +431,11 @@ test('creates a PlaylistLoader on init', function() { | ... | @@ -429,11 +431,11 @@ test('creates a PlaylistLoader on init', function() { |
429 | 431 | ||
430 | equal(requests[0].aborted, true, 'aborted previous src'); | 432 | equal(requests[0].aborted, true, 'aborted previous src'); |
431 | standardXHRResponse(requests[1]); | 433 | standardXHRResponse(requests[1]); |
432 | ok(player.tech.hls.playlists.master, 'set the master playlist'); | 434 | ok(player.tech_.hls.playlists.master, 'set the master playlist'); |
433 | ok(player.tech.hls.playlists.media(), 'set the media playlist'); | 435 | ok(player.tech_.hls.playlists.media(), 'set the media playlist'); |
434 | ok(player.tech.hls.playlists.media().segments, 'the segment entries are parsed'); | 436 | ok(player.tech_.hls.playlists.media().segments, 'the segment entries are parsed'); |
435 | strictEqual(player.tech.hls.playlists.master.playlists[0], | 437 | strictEqual(player.tech_.hls.playlists.master.playlists[0], |
436 | player.tech.hls.playlists.media(), | 438 | player.tech_.hls.playlists.media(), |
437 | 'the playlist is selected'); | 439 | 'the playlist is selected'); |
438 | }); | 440 | }); |
439 | 441 | ||
... | @@ -455,14 +457,14 @@ test('re-initializes the playlist loader when switching sources', function() { | ... | @@ -455,14 +457,14 @@ test('re-initializes the playlist loader when switching sources', function() { |
455 | }); | 457 | }); |
456 | // maybe not needed if https://github.com/videojs/video.js/issues/2326 gets fixed | 458 | // maybe not needed if https://github.com/videojs/video.js/issues/2326 gets fixed |
457 | clock.tick(1); | 459 | clock.tick(1); |
458 | ok(!player.tech.hls.playlists.media(), 'no media playlist'); | 460 | ok(!player.tech_.hls.playlists.media(), 'no media playlist'); |
459 | equal(player.tech.hls.playlists.state, | 461 | equal(player.tech_.hls.playlists.state, |
460 | 'HAVE_NOTHING', | 462 | 'HAVE_NOTHING', |
461 | 'reset the playlist loader state'); | 463 | 'reset the playlist loader state'); |
462 | equal(requests.length, 1, 'requested the new src'); | 464 | equal(requests.length, 1, 'requested the new src'); |
463 | 465 | ||
464 | // buffer check | 466 | // buffer check |
465 | player.tech.hls.checkBuffer_(); | 467 | player.tech_.hls.checkBuffer_(); |
466 | equal(requests.length, 1, 'did not request a stale segment'); | 468 | equal(requests.length, 1, 'did not request a stale segment'); |
467 | 469 | ||
468 | // sourceopen | 470 | // sourceopen |
... | @@ -479,12 +481,12 @@ test('sets the duration if one is available on the playlist', function() { | ... | @@ -479,12 +481,12 @@ test('sets the duration if one is available on the playlist', function() { |
479 | type: 'application/vnd.apple.mpegurl' | 481 | type: 'application/vnd.apple.mpegurl' |
480 | }); | 482 | }); |
481 | openMediaSource(player); | 483 | openMediaSource(player); |
482 | player.tech.on('durationchange', function() { | 484 | player.tech_.on('durationchange', function() { |
483 | events++; | 485 | events++; |
484 | }); | 486 | }); |
485 | 487 | ||
486 | standardXHRResponse(requests[0]); | 488 | standardXHRResponse(requests[0]); |
487 | equal(player.tech.hls.mediaSource.duration, 40, 'set the duration'); | 489 | equal(player.tech_.hls.mediaSource.duration, 40, 'set the duration'); |
488 | equal(events, 1, 'durationchange is fired'); | 490 | equal(events, 1, 'durationchange is fired'); |
489 | }); | 491 | }); |
490 | 492 | ||
... | @@ -495,14 +497,14 @@ QUnit.skip('calculates the duration if needed', function() { | ... | @@ -495,14 +497,14 @@ QUnit.skip('calculates the duration if needed', function() { |
495 | type: 'application/vnd.apple.mpegurl' | 497 | type: 'application/vnd.apple.mpegurl' |
496 | }); | 498 | }); |
497 | openMediaSource(player); | 499 | openMediaSource(player); |
498 | player.tech.hls.mediaSource.duration = NaN; | 500 | player.tech_.hls.mediaSource.duration = NaN; |
499 | player.on('durationchange', function() { | 501 | player.on('durationchange', function() { |
500 | changes++; | 502 | changes++; |
501 | }); | 503 | }); |
502 | 504 | ||
503 | standardXHRResponse(requests[0]); | 505 | standardXHRResponse(requests[0]); |
504 | strictEqual(player.tech.hls.mediaSource.duration, | 506 | strictEqual(player.tech_.hls.mediaSource.duration, |
505 | player.tech.hls.playlists.media().segments.length * 10, | 507 | player.tech_.hls.playlists.media().segments.length * 10, |
506 | 'duration is updated'); | 508 | 'duration is updated'); |
507 | strictEqual(changes, 1, 'one durationchange fired'); | 509 | strictEqual(changes, 1, 'one durationchange fired'); |
508 | }); | 510 | }); |
... | @@ -588,11 +590,11 @@ test('re-initializes the handler for each source', function() { | ... | @@ -588,11 +590,11 @@ test('re-initializes the handler for each source', function() { |
588 | type: 'application/vnd.apple.mpegurl' | 590 | type: 'application/vnd.apple.mpegurl' |
589 | }); | 591 | }); |
590 | openMediaSource(player); | 592 | openMediaSource(player); |
591 | firstPlaylists = player.tech.hls.playlists; | 593 | firstPlaylists = player.tech_.hls.playlists; |
592 | firstMSE = player.tech.hls.mediaSource; | 594 | firstMSE = player.tech_.hls.mediaSource; |
593 | standardXHRResponse(requests.shift()); | 595 | standardXHRResponse(requests.shift()); |
594 | standardXHRResponse(requests.shift()); | 596 | standardXHRResponse(requests.shift()); |
595 | player.tech.hls.sourceBuffer.abort = function() { | 597 | player.tech_.hls.sourceBuffer.abort = function() { |
596 | aborts++; | 598 | aborts++; |
597 | }; | 599 | }; |
598 | 600 | ||
... | @@ -601,8 +603,8 @@ test('re-initializes the handler for each source', function() { | ... | @@ -601,8 +603,8 @@ test('re-initializes the handler for each source', function() { |
601 | type: 'application/vnd.apple.mpegurl' | 603 | type: 'application/vnd.apple.mpegurl' |
602 | }); | 604 | }); |
603 | openMediaSource(player); | 605 | openMediaSource(player); |
604 | secondPlaylists = player.tech.hls.playlists; | 606 | secondPlaylists = player.tech_.hls.playlists; |
605 | secondMSE = player.tech.hls.mediaSource; | 607 | secondMSE = player.tech_.hls.mediaSource; |
606 | 608 | ||
607 | equal(1, aborts, 'aborted the old source buffer'); | 609 | equal(1, aborts, 'aborted the old source buffer'); |
608 | ok(requests[0].aborted, 'aborted the old segment request'); | 610 | ok(requests[0].aborted, 'aborted the old segment request'); |
... | @@ -618,7 +620,7 @@ test('triggers an error when a master playlist request errors', function() { | ... | @@ -618,7 +620,7 @@ test('triggers an error when a master playlist request errors', function() { |
618 | openMediaSource(player); | 620 | openMediaSource(player); |
619 | requests.pop().respond(500); | 621 | requests.pop().respond(500); |
620 | 622 | ||
621 | equal(player.tech.hls.mediaSource.error_, 'network', 'a network error is triggered'); | 623 | equal(player.tech_.hls.mediaSource.error_, 'network', 'a network error is triggered'); |
622 | }); | 624 | }); |
623 | 625 | ||
624 | test('downloads media playlists after loading the master', function() { | 626 | test('downloads media playlists after loading the master', function() { |
... | @@ -629,7 +631,7 @@ test('downloads media playlists after loading the master', function() { | ... | @@ -629,7 +631,7 @@ test('downloads media playlists after loading the master', function() { |
629 | openMediaSource(player); | 631 | openMediaSource(player); |
630 | 632 | ||
631 | // set bandwidth to an appropriate number so we don't switch | 633 | // set bandwidth to an appropriate number so we don't switch |
632 | player.tech.hls.bandwidth = 200000; | 634 | player.tech_.hls.bandwidth = 200000; |
633 | standardXHRResponse(requests[0]); | 635 | standardXHRResponse(requests[0]); |
634 | standardXHRResponse(requests[1]); | 636 | standardXHRResponse(requests[1]); |
635 | standardXHRResponse(requests[2]); | 637 | standardXHRResponse(requests[2]); |
... | @@ -652,8 +654,8 @@ test('upshift if initial bandwidth is high', function() { | ... | @@ -652,8 +654,8 @@ test('upshift if initial bandwidth is high', function() { |
652 | 654 | ||
653 | standardXHRResponse(requests[0]); | 655 | standardXHRResponse(requests[0]); |
654 | 656 | ||
655 | player.tech.hls.playlists.setBandwidth = function() { | 657 | player.tech_.hls.playlists.setBandwidth = function() { |
656 | player.tech.hls.playlists.bandwidth = 1000000000; | 658 | player.tech_.hls.playlists.bandwidth = 1000000000; |
657 | }; | 659 | }; |
658 | 660 | ||
659 | standardXHRResponse(requests[1]); | 661 | standardXHRResponse(requests[1]); |
... | @@ -682,8 +684,8 @@ test('dont downshift if bandwidth is low', function() { | ... | @@ -682,8 +684,8 @@ test('dont downshift if bandwidth is low', function() { |
682 | 684 | ||
683 | standardXHRResponse(requests[0]); | 685 | standardXHRResponse(requests[0]); |
684 | 686 | ||
685 | player.tech.hls.playlists.setBandwidth = function() { | 687 | player.tech_.hls.playlists.setBandwidth = function() { |
686 | player.tech.hls.playlists.bandwidth = 100; | 688 | player.tech_.hls.playlists.bandwidth = 100; |
687 | }; | 689 | }; |
688 | 690 | ||
689 | standardXHRResponse(requests[1]); | 691 | standardXHRResponse(requests[1]); |
... | @@ -710,10 +712,10 @@ test('starts checking the buffer on init', function() { | ... | @@ -710,10 +712,10 @@ test('starts checking the buffer on init', function() { |
710 | 712 | ||
711 | // wait long enough for the buffer check interval to expire and | 713 | // wait long enough for the buffer check interval to expire and |
712 | // trigger fill/drainBuffer | 714 | // trigger fill/drainBuffer |
713 | player.tech.hls.fillBuffer = function() { | 715 | player.tech_.hls.fillBuffer = function() { |
714 | fills++; | 716 | fills++; |
715 | }; | 717 | }; |
716 | player.tech.hls.drainBuffer = function() { | 718 | player.tech_.hls.drainBuffer = function() { |
717 | drains++; | 719 | drains++; |
718 | }; | 720 | }; |
719 | clock.tick(500); | 721 | clock.tick(500); |
... | @@ -732,7 +734,7 @@ test('buffer checks are noops until a media playlist is ready', function() { | ... | @@ -732,7 +734,7 @@ test('buffer checks are noops until a media playlist is ready', function() { |
732 | type: 'application/vnd.apple.mpegurl' | 734 | type: 'application/vnd.apple.mpegurl' |
733 | }); | 735 | }); |
734 | openMediaSource(player); | 736 | openMediaSource(player); |
735 | player.tech.hls.checkBuffer_(); | 737 | player.tech_.hls.checkBuffer_(); |
736 | 738 | ||
737 | strictEqual(1, requests.length, 'one request was made'); | 739 | strictEqual(1, requests.length, 'one request was made'); |
738 | strictEqual(requests[0].url, 'manifest/media.m3u8', 'media playlist requested'); | 740 | strictEqual(requests[0].url, 'manifest/media.m3u8', 'media playlist requested'); |
... | @@ -760,7 +762,7 @@ test('buffer checks are noops when only the master is ready', function() { | ... | @@ -760,7 +762,7 @@ test('buffer checks are noops when only the master is ready', function() { |
760 | // respond with the master playlist but don't send the media playlist yet | 762 | // respond with the master playlist but don't send the media playlist yet |
761 | standardXHRResponse(requests.shift()); | 763 | standardXHRResponse(requests.shift()); |
762 | // trigger fillBuffer() | 764 | // trigger fillBuffer() |
763 | player.tech.hls.checkBuffer_(); | 765 | player.tech_.hls.checkBuffer_(); |
764 | 766 | ||
765 | strictEqual(1, requests.length, 'one request was made'); | 767 | strictEqual(1, requests.length, 'one request was made'); |
766 | strictEqual(requests[0].url, | 768 | strictEqual(requests[0].url, |
... | @@ -782,11 +784,11 @@ test('calculates the bandwidth after downloading a segment', function() { | ... | @@ -782,11 +784,11 @@ test('calculates the bandwidth after downloading a segment', function() { |
782 | 784 | ||
783 | standardXHRResponse(requests[1]); | 785 | standardXHRResponse(requests[1]); |
784 | 786 | ||
785 | ok(player.tech.hls.bandwidth, 'bandwidth is calculated'); | 787 | ok(player.tech_.hls.bandwidth, 'bandwidth is calculated'); |
786 | ok(player.tech.hls.bandwidth > 0, | 788 | ok(player.tech_.hls.bandwidth > 0, |
787 | 'bandwidth is positive: ' + player.tech.hls.bandwidth); | 789 | 'bandwidth is positive: ' + player.tech_.hls.bandwidth); |
788 | ok(player.tech.hls.segmentXhrTime >= 0, | 790 | ok(player.tech_.hls.segmentXhrTime >= 0, |
789 | 'saves segment request time: ' + player.tech.hls.segmentXhrTime + 's'); | 791 | 'saves segment request time: ' + player.tech_.hls.segmentXhrTime + 's'); |
790 | }); | 792 | }); |
791 | 793 | ||
792 | test('fires a progress event after downloading a segment', function() { | 794 | test('fires a progress event after downloading a segment', function() { |
... | @@ -813,14 +815,14 @@ test('selects a playlist after segment downloads', function() { | ... | @@ -813,14 +815,14 @@ test('selects a playlist after segment downloads', function() { |
813 | type: 'application/vnd.apple.mpegurl' | 815 | type: 'application/vnd.apple.mpegurl' |
814 | }); | 816 | }); |
815 | openMediaSource(player); | 817 | openMediaSource(player); |
816 | player.tech.hls.selectPlaylist = function() { | 818 | player.tech_.hls.selectPlaylist = function() { |
817 | calls++; | 819 | calls++; |
818 | return player.tech.hls.playlists.master.playlists[0]; | 820 | return player.tech_.hls.playlists.master.playlists[0]; |
819 | }; | 821 | }; |
820 | 822 | ||
821 | standardXHRResponse(requests[0]); | 823 | standardXHRResponse(requests[0]); |
822 | 824 | ||
823 | player.tech.hls.bandwidth = 3000000; | 825 | player.tech_.hls.bandwidth = 3000000; |
824 | standardXHRResponse(requests[1]); | 826 | standardXHRResponse(requests[1]); |
825 | standardXHRResponse(requests[2]); | 827 | standardXHRResponse(requests[2]); |
826 | 828 | ||
... | @@ -831,7 +833,7 @@ test('selects a playlist after segment downloads', function() { | ... | @@ -831,7 +833,7 @@ test('selects a playlist after segment downloads', function() { |
831 | player.buffered = function() { | 833 | player.buffered = function() { |
832 | return videojs.createTimeRange(0, 2); | 834 | return videojs.createTimeRange(0, 2); |
833 | }; | 835 | }; |
834 | player.tech.hls.checkBuffer_(); | 836 | player.tech_.hls.checkBuffer_(); |
835 | 837 | ||
836 | standardXHRResponse(requests[3]); | 838 | standardXHRResponse(requests[3]); |
837 | 839 | ||
... | @@ -847,15 +849,15 @@ test('moves to the next segment if there is a network error', function() { | ... | @@ -847,15 +849,15 @@ test('moves to the next segment if there is a network error', function() { |
847 | }); | 849 | }); |
848 | openMediaSource(player); | 850 | openMediaSource(player); |
849 | 851 | ||
850 | player.tech.hls.bandwidth = 20000; | 852 | player.tech_.hls.bandwidth = 20000; |
851 | standardXHRResponse(requests[0]); | 853 | standardXHRResponse(requests[0]); |
852 | standardXHRResponse(requests[1]); | 854 | standardXHRResponse(requests[1]); |
853 | 855 | ||
854 | mediaIndex = player.tech.hls.mediaIndex; | 856 | mediaIndex = player.tech_.hls.mediaIndex; |
855 | player.trigger('timeupdate'); | 857 | player.trigger('timeupdate'); |
856 | 858 | ||
857 | requests[2].respond(400); | 859 | requests[2].respond(400); |
858 | strictEqual(mediaIndex + 1, player.tech.hls.mediaIndex, 'media index is incremented'); | 860 | strictEqual(mediaIndex + 1, player.tech_.hls.mediaIndex, 'media index is incremented'); |
859 | }); | 861 | }); |
860 | 862 | ||
861 | test('updates the duration after switching playlists', function() { | 863 | test('updates the duration after switching playlists', function() { |
... | @@ -865,13 +867,13 @@ test('updates the duration after switching playlists', function() { | ... | @@ -865,13 +867,13 @@ test('updates the duration after switching playlists', function() { |
865 | type: 'application/vnd.apple.mpegurl' | 867 | type: 'application/vnd.apple.mpegurl' |
866 | }); | 868 | }); |
867 | openMediaSource(player); | 869 | openMediaSource(player); |
868 | player.tech.hls.selectPlaylist = function() { | 870 | player.tech_.hls.selectPlaylist = function() { |
869 | selectedPlaylist = true; | 871 | selectedPlaylist = true; |
870 | 872 | ||
871 | // this duraiton should be overwritten by the playlist change | 873 | // this duraiton should be overwritten by the playlist change |
872 | player.tech.hls.mediaSource.duration = -Infinity; | 874 | player.tech_.hls.mediaSource.duration = -Infinity; |
873 | 875 | ||
874 | return player.tech.hls.playlists.master.playlists[1]; | 876 | return player.tech_.hls.playlists.master.playlists[1]; |
875 | }; | 877 | }; |
876 | 878 | ||
877 | standardXHRResponse(requests[0]); | 879 | standardXHRResponse(requests[0]); |
... | @@ -879,7 +881,7 @@ test('updates the duration after switching playlists', function() { | ... | @@ -879,7 +881,7 @@ test('updates the duration after switching playlists', function() { |
879 | standardXHRResponse(requests[2]); | 881 | standardXHRResponse(requests[2]); |
880 | standardXHRResponse(requests[3]); | 882 | standardXHRResponse(requests[3]); |
881 | ok(selectedPlaylist, 'selected playlist'); | 883 | ok(selectedPlaylist, 'selected playlist'); |
882 | ok(player.tech.hls.mediaSource.duration !== -Infinity, 'updates the duration'); | 884 | ok(player.tech_.hls.mediaSource.duration !== -Infinity, 'updates the duration'); |
883 | }); | 885 | }); |
884 | 886 | ||
885 | test('downloads additional playlists if required', function() { | 887 | test('downloads additional playlists if required', function() { |
... | @@ -894,12 +896,12 @@ test('downloads additional playlists if required', function() { | ... | @@ -894,12 +896,12 @@ test('downloads additional playlists if required', function() { |
894 | }); | 896 | }); |
895 | openMediaSource(player); | 897 | openMediaSource(player); |
896 | 898 | ||
897 | player.tech.hls.bandwidth = 20000; | 899 | player.tech_.hls.bandwidth = 20000; |
898 | standardXHRResponse(requests[0]); | 900 | standardXHRResponse(requests[0]); |
899 | 901 | ||
900 | standardXHRResponse(requests[1]); | 902 | standardXHRResponse(requests[1]); |
901 | // before an m3u8 is downloaded, no segments are available | 903 | // before an m3u8 is downloaded, no segments are available |
902 | player.tech.hls.selectPlaylist = function() { | 904 | player.tech_.hls.selectPlaylist = function() { |
903 | if (!called) { | 905 | if (!called) { |
904 | called = true; | 906 | called = true; |
905 | return playlist; | 907 | return playlist; |
... | @@ -921,9 +923,9 @@ test('downloads additional playlists if required', function() { | ... | @@ -921,9 +923,9 @@ test('downloads additional playlists if required', function() { |
921 | absoluteUrl('manifest/' + playlist.uri), | 923 | absoluteUrl('manifest/' + playlist.uri), |
922 | 'made playlist request'); | 924 | 'made playlist request'); |
923 | strictEqual(playlist.uri, | 925 | strictEqual(playlist.uri, |
924 | player.tech.hls.playlists.media().uri, | 926 | player.tech_.hls.playlists.media().uri, |
925 | 'a new playlists was selected'); | 927 | 'a new playlists was selected'); |
926 | ok(player.tech.hls.playlists.media().segments, 'segments are now available'); | 928 | ok(player.tech_.hls.playlists.media().segments, 'segments are now available'); |
927 | }); | 929 | }); |
928 | 930 | ||
929 | test('selects a playlist below the current bandwidth', function() { | 931 | test('selects a playlist below the current bandwidth', function() { |
... | @@ -937,15 +939,15 @@ test('selects a playlist below the current bandwidth', function() { | ... | @@ -937,15 +939,15 @@ test('selects a playlist below the current bandwidth', function() { |
937 | standardXHRResponse(requests[0]); | 939 | standardXHRResponse(requests[0]); |
938 | 940 | ||
939 | // the default playlist has a really high bitrate | 941 | // the default playlist has a really high bitrate |
940 | player.tech.hls.playlists.master.playlists[0].attributes.BANDWIDTH = 9e10; | 942 | player.tech_.hls.playlists.master.playlists[0].attributes.BANDWIDTH = 9e10; |
941 | // playlist 1 has a very low bitrate | 943 | // playlist 1 has a very low bitrate |
942 | player.tech.hls.playlists.master.playlists[1].attributes.BANDWIDTH = 1; | 944 | player.tech_.hls.playlists.master.playlists[1].attributes.BANDWIDTH = 1; |
943 | // but the detected client bandwidth is really low | 945 | // but the detected client bandwidth is really low |
944 | player.tech.hls.bandwidth = 10; | 946 | player.tech_.hls.bandwidth = 10; |
945 | 947 | ||
946 | playlist = player.tech.hls.selectPlaylist(); | 948 | playlist = player.tech_.hls.selectPlaylist(); |
947 | strictEqual(playlist, | 949 | strictEqual(playlist, |
948 | player.tech.hls.playlists.master.playlists[1], | 950 | player.tech_.hls.playlists.master.playlists[1], |
949 | 'the low bitrate stream is selected'); | 951 | 'the low bitrate stream is selected'); |
950 | }); | 952 | }); |
951 | 953 | ||
... | @@ -961,7 +963,7 @@ test('scales the bandwidth estimate for the first segment', function() { | ... | @@ -961,7 +963,7 @@ test('scales the bandwidth estimate for the first segment', function() { |
961 | '#EXTM3U\n' + | 963 | '#EXTM3U\n' + |
962 | '#EXT-X-PLAYLIST-TYPE:VOD\n' + | 964 | '#EXT-X-PLAYLIST-TYPE:VOD\n' + |
963 | '#EXT-X-TARGETDURATION:10\n'); | 965 | '#EXT-X-TARGETDURATION:10\n'); |
964 | equal(player.tech.hls.bandwidth, 500 * 5, 'scaled the bandwidth estimate by 5'); | 966 | equal(player.tech_.hls.bandwidth, 500 * 5, 'scaled the bandwidth estimate by 5'); |
965 | }); | 967 | }); |
966 | 968 | ||
967 | test('allows initial bandwidth to be provided', function() { | 969 | test('allows initial bandwidth to be provided', function() { |
... | @@ -970,14 +972,14 @@ test('allows initial bandwidth to be provided', function() { | ... | @@ -970,14 +972,14 @@ test('allows initial bandwidth to be provided', function() { |
970 | type: 'application/vnd.apple.mpegurl' | 972 | type: 'application/vnd.apple.mpegurl' |
971 | }); | 973 | }); |
972 | openMediaSource(player); | 974 | openMediaSource(player); |
973 | player.tech.hls.bandwidth = 500; | 975 | player.tech_.hls.bandwidth = 500; |
974 | 976 | ||
975 | requests[0].bandwidth = 1; | 977 | requests[0].bandwidth = 1; |
976 | requests.shift().respond(200, null, | 978 | requests.shift().respond(200, null, |
977 | '#EXTM3U\n' + | 979 | '#EXTM3U\n' + |
978 | '#EXT-X-PLAYLIST-TYPE:VOD\n' + | 980 | '#EXT-X-PLAYLIST-TYPE:VOD\n' + |
979 | '#EXT-X-TARGETDURATION:10\n'); | 981 | '#EXT-X-TARGETDURATION:10\n'); |
980 | equal(player.tech.hls.bandwidth, 500, 'prefers user-specified intial bandwidth'); | 982 | equal(player.tech_.hls.bandwidth, 500, 'prefers user-specified intial bandwidth'); |
981 | }); | 983 | }); |
982 | 984 | ||
983 | test('raises the minimum bitrate for a stream proportionially', function() { | 985 | test('raises the minimum bitrate for a stream proportionially', function() { |
... | @@ -991,15 +993,15 @@ test('raises the minimum bitrate for a stream proportionially', function() { | ... | @@ -991,15 +993,15 @@ test('raises the minimum bitrate for a stream proportionially', function() { |
991 | standardXHRResponse(requests[0]); | 993 | standardXHRResponse(requests[0]); |
992 | 994 | ||
993 | // the default playlist's bandwidth + 10% is equal to the current bandwidth | 995 | // the default playlist's bandwidth + 10% is equal to the current bandwidth |
994 | player.tech.hls.playlists.master.playlists[0].attributes.BANDWIDTH = 10; | 996 | player.tech_.hls.playlists.master.playlists[0].attributes.BANDWIDTH = 10; |
995 | player.tech.hls.bandwidth = 11; | 997 | player.tech_.hls.bandwidth = 11; |
996 | 998 | ||
997 | // 9.9 * 1.1 < 11 | 999 | // 9.9 * 1.1 < 11 |
998 | player.tech.hls.playlists.master.playlists[1].attributes.BANDWIDTH = 9.9; | 1000 | player.tech_.hls.playlists.master.playlists[1].attributes.BANDWIDTH = 9.9; |
999 | playlist = player.tech.hls.selectPlaylist(); | 1001 | playlist = player.tech_.hls.selectPlaylist(); |
1000 | 1002 | ||
1001 | strictEqual(playlist, | 1003 | strictEqual(playlist, |
1002 | player.tech.hls.playlists.master.playlists[1], | 1004 | player.tech_.hls.playlists.master.playlists[1], |
1003 | 'a lower bitrate stream is selected'); | 1005 | 'a lower bitrate stream is selected'); |
1004 | }); | 1006 | }); |
1005 | 1007 | ||
... | @@ -1014,12 +1016,12 @@ test('uses the lowest bitrate if no other is suitable', function() { | ... | @@ -1014,12 +1016,12 @@ test('uses the lowest bitrate if no other is suitable', function() { |
1014 | standardXHRResponse(requests[0]); | 1016 | standardXHRResponse(requests[0]); |
1015 | 1017 | ||
1016 | // the lowest bitrate playlist is much greater than 1b/s | 1018 | // the lowest bitrate playlist is much greater than 1b/s |
1017 | player.tech.hls.bandwidth = 1; | 1019 | player.tech_.hls.bandwidth = 1; |
1018 | playlist = player.tech.hls.selectPlaylist(); | 1020 | playlist = player.tech_.hls.selectPlaylist(); |
1019 | 1021 | ||
1020 | // playlist 1 has the lowest advertised bitrate | 1022 | // playlist 1 has the lowest advertised bitrate |
1021 | strictEqual(playlist, | 1023 | strictEqual(playlist, |
1022 | player.tech.hls.playlists.master.playlists[1], | 1024 | player.tech_.hls.playlists.master.playlists[1], |
1023 | 'the lowest bitrate stream is selected'); | 1025 | 'the lowest bitrate stream is selected'); |
1024 | }); | 1026 | }); |
1025 | 1027 | ||
... | @@ -1037,18 +1039,18 @@ test('uses the lowest bitrate if no other is suitable', function() { | ... | @@ -1037,18 +1039,18 @@ test('uses the lowest bitrate if no other is suitable', function() { |
1037 | 1039 | ||
1038 | player.width(640); | 1040 | player.width(640); |
1039 | player.height(360); | 1041 | player.height(360); |
1040 | player.tech.hls.bandwidth = 3000000; | 1042 | player.tech_.hls.bandwidth = 3000000; |
1041 | 1043 | ||
1042 | playlist = player.tech.hls.selectPlaylist(); | 1044 | playlist = player.tech_.hls.selectPlaylist(); |
1043 | 1045 | ||
1044 | deepEqual(playlist.attributes.RESOLUTION, {width:960,height:540},'should return the correct resolution by player dimensions'); | 1046 | deepEqual(playlist.attributes.RESOLUTION, {width:960,height:540},'should return the correct resolution by player dimensions'); |
1045 | equal(playlist.attributes.BANDWIDTH, 1928000, 'should have the expected bandwidth in case of multiple'); | 1047 | equal(playlist.attributes.BANDWIDTH, 1928000, 'should have the expected bandwidth in case of multiple'); |
1046 | 1048 | ||
1047 | player.width(1920); | 1049 | player.width(1920); |
1048 | player.height(1080); | 1050 | player.height(1080); |
1049 | player.tech.hls.bandwidth = 3000000; | 1051 | player.tech_.hls.bandwidth = 3000000; |
1050 | 1052 | ||
1051 | playlist = player.tech.hls.selectPlaylist(); | 1053 | playlist = player.tech_.hls.selectPlaylist(); |
1052 | 1054 | ||
1053 | deepEqual(playlist.attributes.RESOLUTION, { | 1055 | deepEqual(playlist.attributes.RESOLUTION, { |
1054 | width:960, | 1056 | width:960, |
... | @@ -1058,7 +1060,7 @@ test('uses the lowest bitrate if no other is suitable', function() { | ... | @@ -1058,7 +1060,7 @@ test('uses the lowest bitrate if no other is suitable', function() { |
1058 | 1060 | ||
1059 | player.width(396); | 1061 | player.width(396); |
1060 | player.height(224); | 1062 | player.height(224); |
1061 | playlist = player.tech.hls.selectPlaylist(); | 1063 | playlist = player.tech_.hls.selectPlaylist(); |
1062 | 1064 | ||
1063 | deepEqual(playlist.attributes.RESOLUTION, { | 1065 | deepEqual(playlist.attributes.RESOLUTION, { |
1064 | width:396, | 1066 | width:396, |
... | @@ -1083,12 +1085,12 @@ test('selects the highest bitrate playlist when the player dimensions are ' + | ... | @@ -1083,12 +1085,12 @@ test('selects the highest bitrate playlist when the player dimensions are ' + |
1083 | '#EXT-X-STREAM-INF:BANDWIDTH=1,RESOLUTION=1x1\n' + | 1085 | '#EXT-X-STREAM-INF:BANDWIDTH=1,RESOLUTION=1x1\n' + |
1084 | 'media1.m3u8\n'); // master | 1086 | 'media1.m3u8\n'); // master |
1085 | standardXHRResponse(requests.shift()); // media | 1087 | standardXHRResponse(requests.shift()); // media |
1086 | player.tech.hls.bandwidth = 1e10; | 1088 | player.tech_.hls.bandwidth = 1e10; |
1087 | 1089 | ||
1088 | player.width(1024); | 1090 | player.width(1024); |
1089 | player.height(768); | 1091 | player.height(768); |
1090 | 1092 | ||
1091 | playlist = player.tech.hls.selectPlaylist(); | 1093 | playlist = player.tech_.hls.selectPlaylist(); |
1092 | 1094 | ||
1093 | equal(playlist.attributes.BANDWIDTH, | 1095 | equal(playlist.attributes.BANDWIDTH, |
1094 | 1000, | 1096 | 1000, |
... | @@ -1101,10 +1103,10 @@ test('does not download the next segment if the buffer is full', function() { | ... | @@ -1101,10 +1103,10 @@ test('does not download the next segment if the buffer is full', function() { |
1101 | src: 'manifest/media.m3u8', | 1103 | src: 'manifest/media.m3u8', |
1102 | type: 'application/vnd.apple.mpegurl' | 1104 | type: 'application/vnd.apple.mpegurl' |
1103 | }); | 1105 | }); |
1104 | player.tech.currentTime = function() { | 1106 | player.tech_.currentTime = function() { |
1105 | return currentTime; | 1107 | return currentTime; |
1106 | }; | 1108 | }; |
1107 | player.tech.buffered = function() { | 1109 | player.tech_.buffered = function() { |
1108 | return videojs.createTimeRange(0, currentTime + videojs.Hls.GOAL_BUFFER_LENGTH); | 1110 | return videojs.createTimeRange(0, currentTime + videojs.Hls.GOAL_BUFFER_LENGTH); |
1109 | }; | 1111 | }; |
1110 | openMediaSource(player); | 1112 | openMediaSource(player); |
... | @@ -1127,13 +1129,13 @@ test('downloads the next segment if the buffer is getting low', function() { | ... | @@ -1127,13 +1129,13 @@ test('downloads the next segment if the buffer is getting low', function() { |
1127 | standardXHRResponse(requests[1]); | 1129 | standardXHRResponse(requests[1]); |
1128 | 1130 | ||
1129 | strictEqual(requests.length, 2, 'made two requests'); | 1131 | strictEqual(requests.length, 2, 'made two requests'); |
1130 | player.tech.currentTime = function() { | 1132 | player.tech_.currentTime = function() { |
1131 | return 15; | 1133 | return 15; |
1132 | }; | 1134 | }; |
1133 | player.tech.buffered = function() { | 1135 | player.tech_.buffered = function() { |
1134 | return videojs.createTimeRange(0, 19.999); | 1136 | return videojs.createTimeRange(0, 19.999); |
1135 | }; | 1137 | }; |
1136 | player.tech.hls.checkBuffer_(); | 1138 | player.tech_.hls.checkBuffer_(); |
1137 | 1139 | ||
1138 | standardXHRResponse(requests[2]); | 1140 | standardXHRResponse(requests[2]); |
1139 | 1141 | ||
... | @@ -1144,11 +1146,11 @@ test('downloads the next segment if the buffer is getting low', function() { | ... | @@ -1144,11 +1146,11 @@ test('downloads the next segment if the buffer is getting low', function() { |
1144 | }); | 1146 | }); |
1145 | 1147 | ||
1146 | test('buffers based on the correct TimeRange if multiple ranges exist', function() { | 1148 | test('buffers based on the correct TimeRange if multiple ranges exist', function() { |
1147 | player.tech.currentTime = function() { | 1149 | player.tech_.currentTime = function() { |
1148 | return 8; | 1150 | return 8; |
1149 | }; | 1151 | }; |
1150 | 1152 | ||
1151 | player.tech.buffered = function() { | 1153 | player.tech_.buffered = function() { |
1152 | return { | 1154 | return { |
1153 | start: function(num) { | 1155 | start: function(num) { |
1154 | switch (num) { | 1156 | switch (num) { |
... | @@ -1184,19 +1186,19 @@ test('buffers based on the correct TimeRange if multiple ranges exist', function | ... | @@ -1184,19 +1186,19 @@ test('buffers based on the correct TimeRange if multiple ranges exist', function |
1184 | absoluteUrl('manifest/media-00001.ts'), | 1186 | absoluteUrl('manifest/media-00001.ts'), |
1185 | 'made segment request'); | 1187 | 'made segment request'); |
1186 | 1188 | ||
1187 | player.tech.currentTime = function() { | 1189 | player.tech_.currentTime = function() { |
1188 | return 55; | 1190 | return 55; |
1189 | }; | 1191 | }; |
1190 | 1192 | ||
1191 | player.tech.hls.checkBuffer_(); | 1193 | player.tech_.hls.checkBuffer_(); |
1192 | 1194 | ||
1193 | strictEqual(requests.length, 2, 'made no additional requests'); | 1195 | strictEqual(requests.length, 2, 'made no additional requests'); |
1194 | 1196 | ||
1195 | player.tech.currentTime = function() { | 1197 | player.tech_.currentTime = function() { |
1196 | return 134; | 1198 | return 134; |
1197 | }; | 1199 | }; |
1198 | 1200 | ||
1199 | player.tech.hls.checkBuffer_(); | 1201 | player.tech_.hls.checkBuffer_(); |
1200 | standardXHRResponse(requests[2]); | 1202 | standardXHRResponse(requests[2]); |
1201 | 1203 | ||
1202 | strictEqual(requests.length, 3, 'made three requests'); | 1204 | strictEqual(requests.length, 3, 'made three requests'); |
... | @@ -1214,7 +1216,7 @@ test('stops downloading segments at the end of the playlist', function() { | ... | @@ -1214,7 +1216,7 @@ test('stops downloading segments at the end of the playlist', function() { |
1214 | openMediaSource(player); | 1216 | openMediaSource(player); |
1215 | standardXHRResponse(requests[0]); | 1217 | standardXHRResponse(requests[0]); |
1216 | requests = []; | 1218 | requests = []; |
1217 | player.tech.hls.mediaIndex = 4; | 1219 | player.tech_.hls.mediaIndex = 4; |
1218 | player.trigger('timeupdate'); | 1220 | player.trigger('timeupdate'); |
1219 | 1221 | ||
1220 | strictEqual(requests.length, 0, 'no request is made'); | 1222 | strictEqual(requests.length, 0, 'no request is made'); |
... | @@ -1244,14 +1246,14 @@ test('only appends one segment at a time', function() { | ... | @@ -1244,14 +1246,14 @@ test('only appends one segment at a time', function() { |
1244 | standardXHRResponse(requests.pop()); // media.m3u8 | 1246 | standardXHRResponse(requests.pop()); // media.m3u8 |
1245 | standardXHRResponse(requests.pop()); // segment 0 | 1247 | standardXHRResponse(requests.pop()); // segment 0 |
1246 | 1248 | ||
1247 | player.tech.hls.sourceBuffer.updating = true; | 1249 | player.tech_.hls.sourceBuffer.updating = true; |
1248 | player.tech.hls.sourceBuffer.appendBuffer = function() { | 1250 | player.tech_.hls.sourceBuffer.appendBuffer = function() { |
1249 | appends++; | 1251 | appends++; |
1250 | }; | 1252 | }; |
1251 | 1253 | ||
1252 | player.tech.hls.checkBuffer_(); | 1254 | player.tech_.hls.checkBuffer_(); |
1253 | standardXHRResponse(requests.pop()); // segment 1 | 1255 | standardXHRResponse(requests.pop()); // segment 1 |
1254 | player.tech.hls.checkBuffer_(); // should be a no-op | 1256 | player.tech_.hls.checkBuffer_(); // should be a no-op |
1255 | equal(appends, 0, 'did not append while updating'); | 1257 | equal(appends, 0, 'did not append while updating'); |
1256 | }); | 1258 | }); |
1257 | 1259 | ||
... | @@ -1269,10 +1271,10 @@ QUnit.skip('records the min and max PTS values for a segment', function() { | ... | @@ -1269,10 +1271,10 @@ QUnit.skip('records the min and max PTS values for a segment', function() { |
1269 | tags.push({ pts: 10, bytes: new Uint8Array(1) }); | 1271 | tags.push({ pts: 10, bytes: new Uint8Array(1) }); |
1270 | standardXHRResponse(requests.pop()); // segment 0 | 1272 | standardXHRResponse(requests.pop()); // segment 0 |
1271 | 1273 | ||
1272 | equal(player.tech.hls.playlists.media().segments[0].minVideoPts, 0, 'recorded min video pts'); | 1274 | equal(player.tech_.hls.playlists.media().segments[0].minVideoPts, 0, 'recorded min video pts'); |
1273 | equal(player.tech.hls.playlists.media().segments[0].maxVideoPts, 10, 'recorded max video pts'); | 1275 | equal(player.tech_.hls.playlists.media().segments[0].maxVideoPts, 10, 'recorded max video pts'); |
1274 | equal(player.tech.hls.playlists.media().segments[0].minAudioPts, 0, 'recorded min audio pts'); | 1276 | equal(player.tech_.hls.playlists.media().segments[0].minAudioPts, 0, 'recorded min audio pts'); |
1275 | equal(player.tech.hls.playlists.media().segments[0].maxAudioPts, 10, 'recorded max audio pts'); | 1277 | equal(player.tech_.hls.playlists.media().segments[0].maxAudioPts, 10, 'recorded max audio pts'); |
1276 | }); | 1278 | }); |
1277 | 1279 | ||
1278 | QUnit.skip('records PTS values for video-only segments', function() { | 1280 | QUnit.skip('records PTS values for video-only segments', function() { |
... | @@ -1285,23 +1287,23 @@ QUnit.skip('records PTS values for video-only segments', function() { | ... | @@ -1285,23 +1287,23 @@ QUnit.skip('records PTS values for video-only segments', function() { |
1285 | openMediaSource(player); | 1287 | openMediaSource(player); |
1286 | standardXHRResponse(requests.pop()); // media.m3u8 | 1288 | standardXHRResponse(requests.pop()); // media.m3u8 |
1287 | 1289 | ||
1288 | player.tech.hls.segmentParser_.stats.aacTags = function() { | 1290 | player.tech_.hls.segmentParser_.stats.aacTags = function() { |
1289 | return 0; | 1291 | return 0; |
1290 | }; | 1292 | }; |
1291 | player.tech.hls.segmentParser_.stats.minAudioPts = function() { | 1293 | player.tech_.hls.segmentParser_.stats.minAudioPts = function() { |
1292 | throw new Error('No audio tags'); | 1294 | throw new Error('No audio tags'); |
1293 | }; | 1295 | }; |
1294 | player.tech.hls.segmentParser_.stats.maxAudioPts = function() { | 1296 | player.tech_.hls.segmentParser_.stats.maxAudioPts = function() { |
1295 | throw new Error('No audio tags'); | 1297 | throw new Error('No audio tags'); |
1296 | }; | 1298 | }; |
1297 | tags.push({ pts: 0, bytes: new Uint8Array(1) }); | 1299 | tags.push({ pts: 0, bytes: new Uint8Array(1) }); |
1298 | tags.push({ pts: 10, bytes: new Uint8Array(1) }); | 1300 | tags.push({ pts: 10, bytes: new Uint8Array(1) }); |
1299 | standardXHRResponse(requests.pop()); // segment 0 | 1301 | standardXHRResponse(requests.pop()); // segment 0 |
1300 | 1302 | ||
1301 | equal(player.tech.hls.playlists.media().segments[0].minVideoPts, 0, 'recorded min video pts'); | 1303 | equal(player.tech_.hls.playlists.media().segments[0].minVideoPts, 0, 'recorded min video pts'); |
1302 | equal(player.tech.hls.playlists.media().segments[0].maxVideoPts, 10, 'recorded max video pts'); | 1304 | equal(player.tech_.hls.playlists.media().segments[0].maxVideoPts, 10, 'recorded max video pts'); |
1303 | strictEqual(player.tech.hls.playlists.media().segments[0].minAudioPts, undefined, 'min audio pts is undefined'); | 1305 | strictEqual(player.tech_.hls.playlists.media().segments[0].minAudioPts, undefined, 'min audio pts is undefined'); |
1304 | strictEqual(player.tech.hls.playlists.media().segments[0].maxAudioPts, undefined, 'max audio pts is undefined'); | 1306 | strictEqual(player.tech_.hls.playlists.media().segments[0].maxAudioPts, undefined, 'max audio pts is undefined'); |
1305 | }); | 1307 | }); |
1306 | 1308 | ||
1307 | QUnit.skip('records PTS values for audio-only segments', function() { | 1309 | QUnit.skip('records PTS values for audio-only segments', function() { |
... | @@ -1314,23 +1316,23 @@ QUnit.skip('records PTS values for audio-only segments', function() { | ... | @@ -1314,23 +1316,23 @@ QUnit.skip('records PTS values for audio-only segments', function() { |
1314 | openMediaSource(player); | 1316 | openMediaSource(player); |
1315 | standardXHRResponse(requests.pop()); // media.m3u8 | 1317 | standardXHRResponse(requests.pop()); // media.m3u8 |
1316 | 1318 | ||
1317 | player.tech.hls.segmentParser_.stats.h264Tags = function() { | 1319 | player.tech_.hls.segmentParser_.stats.h264Tags = function() { |
1318 | return 0; | 1320 | return 0; |
1319 | }; | 1321 | }; |
1320 | player.tech.hls.segmentParser_.stats.minVideoPts = function() { | 1322 | player.tech_.hls.segmentParser_.stats.minVideoPts = function() { |
1321 | throw new Error('No video tags'); | 1323 | throw new Error('No video tags'); |
1322 | }; | 1324 | }; |
1323 | player.tech.hls.segmentParser_.stats.maxVideoPts = function() { | 1325 | player.tech_.hls.segmentParser_.stats.maxVideoPts = function() { |
1324 | throw new Error('No video tags'); | 1326 | throw new Error('No video tags'); |
1325 | }; | 1327 | }; |
1326 | tags.push({ pts: 0, bytes: new Uint8Array(1) }); | 1328 | tags.push({ pts: 0, bytes: new Uint8Array(1) }); |
1327 | tags.push({ pts: 10, bytes: new Uint8Array(1) }); | 1329 | tags.push({ pts: 10, bytes: new Uint8Array(1) }); |
1328 | standardXHRResponse(requests.pop()); // segment 0 | 1330 | standardXHRResponse(requests.pop()); // segment 0 |
1329 | 1331 | ||
1330 | equal(player.tech.hls.playlists.media().segments[0].minAudioPts, 0, 'recorded min audio pts'); | 1332 | equal(player.tech_.hls.playlists.media().segments[0].minAudioPts, 0, 'recorded min audio pts'); |
1331 | equal(player.tech.hls.playlists.media().segments[0].maxAudioPts, 10, 'recorded max audio pts'); | 1333 | equal(player.tech_.hls.playlists.media().segments[0].maxAudioPts, 10, 'recorded max audio pts'); |
1332 | strictEqual(player.tech.hls.playlists.media().segments[0].minVideoPts, undefined, 'min video pts is undefined'); | 1334 | strictEqual(player.tech_.hls.playlists.media().segments[0].minVideoPts, undefined, 'min video pts is undefined'); |
1333 | strictEqual(player.tech.hls.playlists.media().segments[0].maxVideoPts, undefined, 'max video pts is undefined'); | 1335 | strictEqual(player.tech_.hls.playlists.media().segments[0].maxVideoPts, undefined, 'max video pts is undefined'); |
1334 | }); | 1336 | }); |
1335 | 1337 | ||
1336 | test('waits to download new segments until the media playlist is stable', function() { | 1338 | test('waits to download new segments until the media playlist is stable', function() { |
... | @@ -1341,24 +1343,24 @@ test('waits to download new segments until the media playlist is stable', functi | ... | @@ -1341,24 +1343,24 @@ test('waits to download new segments until the media playlist is stable', functi |
1341 | }); | 1343 | }); |
1342 | openMediaSource(player); | 1344 | openMediaSource(player); |
1343 | standardXHRResponse(requests.shift()); // master | 1345 | standardXHRResponse(requests.shift()); // master |
1344 | player.tech.hls.bandwidth = 1; // make sure we stay on the lowest variant | 1346 | player.tech_.hls.bandwidth = 1; // make sure we stay on the lowest variant |
1345 | standardXHRResponse(requests.shift()); // media | 1347 | standardXHRResponse(requests.shift()); // media |
1346 | 1348 | ||
1347 | // mock a playlist switch | 1349 | // mock a playlist switch |
1348 | media = player.tech.hls.playlists.media(); | 1350 | media = player.tech_.hls.playlists.media(); |
1349 | player.tech.hls.playlists.media = function() { | 1351 | player.tech_.hls.playlists.media = function() { |
1350 | return media; | 1352 | return media; |
1351 | }; | 1353 | }; |
1352 | player.tech.hls.playlists.state = 'SWITCHING_MEDIA'; | 1354 | player.tech_.hls.playlists.state = 'SWITCHING_MEDIA'; |
1353 | 1355 | ||
1354 | standardXHRResponse(requests.shift()); // segment 0 | 1356 | standardXHRResponse(requests.shift()); // segment 0 |
1355 | 1357 | ||
1356 | equal(requests.length, 0, 'no requests outstanding'); | 1358 | equal(requests.length, 0, 'no requests outstanding'); |
1357 | player.tech.hls.checkBuffer_(); | 1359 | player.tech_.hls.checkBuffer_(); |
1358 | equal(requests.length, 0, 'delays segment fetching'); | 1360 | equal(requests.length, 0, 'delays segment fetching'); |
1359 | 1361 | ||
1360 | player.tech.hls.playlists.state = 'LOADED_METADATA'; | 1362 | player.tech_.hls.playlists.state = 'LOADED_METADATA'; |
1361 | player.tech.hls.checkBuffer_(); | 1363 | player.tech_.hls.checkBuffer_(); |
1362 | equal(requests.length, 1, 'resumes segment fetching'); | 1364 | equal(requests.length, 1, 'resumes segment fetching'); |
1363 | }); | 1365 | }); |
1364 | 1366 | ||
... | @@ -1369,7 +1371,7 @@ test('cancels outstanding XHRs when seeking', function() { | ... | @@ -1369,7 +1371,7 @@ test('cancels outstanding XHRs when seeking', function() { |
1369 | }); | 1371 | }); |
1370 | openMediaSource(player); | 1372 | openMediaSource(player); |
1371 | standardXHRResponse(requests[0]); | 1373 | standardXHRResponse(requests[0]); |
1372 | player.tech.hls.media = { | 1374 | player.tech_.hls.media = { |
1373 | segments: [{ | 1375 | segments: [{ |
1374 | uri: '0.ts', | 1376 | uri: '0.ts', |
1375 | duration: 10 | 1377 | duration: 10 |
... | @@ -1400,7 +1402,7 @@ test('when outstanding XHRs are cancelled, they get aborted properly', function( | ... | @@ -1400,7 +1402,7 @@ test('when outstanding XHRs are cancelled, they get aborted properly', function( |
1400 | // trigger a segment download request | 1402 | // trigger a segment download request |
1401 | player.trigger('timeupdate'); | 1403 | player.trigger('timeupdate'); |
1402 | 1404 | ||
1403 | player.tech.hls.segmentXhr_.onreadystatechange = function() { | 1405 | player.tech_.hls.segmentXhr_.onreadystatechange = function() { |
1404 | readystatechanges++; | 1406 | readystatechanges++; |
1405 | }; | 1407 | }; |
1406 | 1408 | ||
... | @@ -1410,7 +1412,7 @@ test('when outstanding XHRs are cancelled, they get aborted properly', function( | ... | @@ -1410,7 +1412,7 @@ test('when outstanding XHRs are cancelled, they get aborted properly', function( |
1410 | 1412 | ||
1411 | ok(requests[1].aborted, 'XHR aborted'); | 1413 | ok(requests[1].aborted, 'XHR aborted'); |
1412 | strictEqual(requests.length, 3, 'opened new XHR'); | 1414 | strictEqual(requests.length, 3, 'opened new XHR'); |
1413 | notEqual(player.tech.hls.segmentXhr_.url, requests[1].url, 'a new segment is request that is not the aborted one'); | 1415 | notEqual(player.tech_.hls.segmentXhr_.url, requests[1].url, 'a new segment is request that is not the aborted one'); |
1414 | strictEqual(readystatechanges, 0, 'onreadystatechange was not called'); | 1416 | strictEqual(readystatechanges, 0, 'onreadystatechange was not called'); |
1415 | }); | 1417 | }); |
1416 | 1418 | ||
... | @@ -1432,15 +1434,15 @@ test('segmentXhr is properly nulled out when dispose is called', function() { | ... | @@ -1432,15 +1434,15 @@ test('segmentXhr is properly nulled out when dispose is called', function() { |
1432 | // trigger a segment download request | 1434 | // trigger a segment download request |
1433 | player.trigger('timeupdate'); | 1435 | player.trigger('timeupdate'); |
1434 | 1436 | ||
1435 | player.tech.hls.segmentXhr_.onreadystatechange = function() { | 1437 | player.tech_.hls.segmentXhr_.onreadystatechange = function() { |
1436 | readystatechanges++; | 1438 | readystatechanges++; |
1437 | }; | 1439 | }; |
1438 | 1440 | ||
1439 | player.tech.hls.dispose(); | 1441 | player.tech_.hls.dispose(); |
1440 | 1442 | ||
1441 | ok(requests[1].aborted, 'XHR aborted'); | 1443 | ok(requests[1].aborted, 'XHR aborted'); |
1442 | strictEqual(requests.length, 2, 'did not open a new XHR'); | 1444 | strictEqual(requests.length, 2, 'did not open a new XHR'); |
1443 | equal(player.tech.hls.segmentXhr_, null, 'the segment xhr is nulled out'); | 1445 | equal(player.tech_.hls.segmentXhr_, null, 'the segment xhr is nulled out'); |
1444 | strictEqual(readystatechanges, 0, 'onreadystatechange was not called'); | 1446 | strictEqual(readystatechanges, 0, 'onreadystatechange was not called'); |
1445 | 1447 | ||
1446 | Flash.prototype.dispose = oldDispose; | 1448 | Flash.prototype.dispose = oldDispose; |
... | @@ -1455,9 +1457,9 @@ QUnit.skip('exposes in-band metadata events as cues', function() { | ... | @@ -1455,9 +1457,9 @@ QUnit.skip('exposes in-band metadata events as cues', function() { |
1455 | }); | 1457 | }); |
1456 | openMediaSource(player); | 1458 | openMediaSource(player); |
1457 | 1459 | ||
1458 | player.tech.hls.segmentParser_.parseSegmentBinaryData = function() { | 1460 | player.tech_.hls.segmentParser_.parseSegmentBinaryData = function() { |
1459 | // trigger a metadata event | 1461 | // trigger a metadata event |
1460 | player.tech.hls.segmentParser_.metadataStream.trigger('data', { | 1462 | player.tech_.hls.segmentParser_.metadataStream.trigger('data', { |
1461 | pts: 2000, | 1463 | pts: 2000, |
1462 | data: new Uint8Array([]), | 1464 | data: new Uint8Array([]), |
1463 | frames: [{ | 1465 | frames: [{ |
... | @@ -1511,9 +1513,9 @@ QUnit.skip('only adds in-band cues the first time they are encountered', functio | ... | @@ -1511,9 +1513,9 @@ QUnit.skip('only adds in-band cues the first time they are encountered', functio |
1511 | }); | 1513 | }); |
1512 | openMediaSource(player); | 1514 | openMediaSource(player); |
1513 | 1515 | ||
1514 | player.tech.hls.segmentParser_.parseSegmentBinaryData = function() { | 1516 | player.tech_.hls.segmentParser_.parseSegmentBinaryData = function() { |
1515 | // trigger a metadata event | 1517 | // trigger a metadata event |
1516 | player.tech.hls.segmentParser_.metadataStream.trigger('data', { | 1518 | player.tech_.hls.segmentParser_.metadataStream.trigger('data', { |
1517 | pts: 2000, | 1519 | pts: 2000, |
1518 | data: new Uint8Array([]), | 1520 | data: new Uint8Array([]), |
1519 | frames: [{ | 1521 | frames: [{ |
... | @@ -1526,7 +1528,7 @@ QUnit.skip('only adds in-band cues the first time they are encountered', functio | ... | @@ -1526,7 +1528,7 @@ QUnit.skip('only adds in-band cues the first time they are encountered', functio |
1526 | standardXHRResponse(requests.shift()); | 1528 | standardXHRResponse(requests.shift()); |
1527 | // seek back to the first segment | 1529 | // seek back to the first segment |
1528 | player.currentTime(0); | 1530 | player.currentTime(0); |
1529 | player.tech.hls.trigger('seeking'); | 1531 | player.tech_.hls.trigger('seeking'); |
1530 | tags.push({ pts: 0, bytes: new Uint8Array(1) }); | 1532 | tags.push({ pts: 0, bytes: new Uint8Array(1) }); |
1531 | standardXHRResponse(requests.shift()); | 1533 | standardXHRResponse(requests.shift()); |
1532 | 1534 | ||
... | @@ -1546,10 +1548,10 @@ QUnit.skip('clears in-band cues ahead of current time on seek', function() { | ... | @@ -1546,10 +1548,10 @@ QUnit.skip('clears in-band cues ahead of current time on seek', function() { |
1546 | }); | 1548 | }); |
1547 | openMediaSource(player); | 1549 | openMediaSource(player); |
1548 | 1550 | ||
1549 | player.tech.hls.segmentParser_.parseSegmentBinaryData = function() { | 1551 | player.tech_.hls.segmentParser_.parseSegmentBinaryData = function() { |
1550 | // trigger a metadata event | 1552 | // trigger a metadata event |
1551 | while (events.length) { | 1553 | while (events.length) { |
1552 | player.tech.hls.segmentParser_.metadataStream.trigger('data', events.shift()); | 1554 | player.tech_.hls.segmentParser_.metadataStream.trigger('data', events.shift()); |
1553 | } | 1555 | } |
1554 | }; | 1556 | }; |
1555 | standardXHRResponse(requests.shift()); // media | 1557 | standardXHRResponse(requests.shift()); // media |
... | @@ -1582,7 +1584,7 @@ QUnit.skip('clears in-band cues ahead of current time on seek', function() { | ... | @@ -1582,7 +1584,7 @@ QUnit.skip('clears in-band cues ahead of current time on seek', function() { |
1582 | value: 'cue 2' | 1584 | value: 'cue 2' |
1583 | }] | 1585 | }] |
1584 | }); | 1586 | }); |
1585 | player.tech.hls.checkBuffer_(); | 1587 | player.tech_.hls.checkBuffer_(); |
1586 | standardXHRResponse(requests.shift()); // segment 1 | 1588 | standardXHRResponse(requests.shift()); // segment 1 |
1587 | 1589 | ||
1588 | track = player.textTracks()[0]; | 1590 | track = player.textTracks()[0]; |
... | @@ -1604,9 +1606,9 @@ QUnit.skip('translates ID3 PTS values to cue media timeline positions', function | ... | @@ -1604,9 +1606,9 @@ QUnit.skip('translates ID3 PTS values to cue media timeline positions', function |
1604 | }); | 1606 | }); |
1605 | openMediaSource(player); | 1607 | openMediaSource(player); |
1606 | 1608 | ||
1607 | player.tech.hls.segmentParser_.parseSegmentBinaryData = function() { | 1609 | player.tech_.hls.segmentParser_.parseSegmentBinaryData = function() { |
1608 | // trigger a metadata event | 1610 | // trigger a metadata event |
1609 | player.tech.hls.segmentParser_.metadataStream.trigger('data', { | 1611 | player.tech_.hls.segmentParser_.metadataStream.trigger('data', { |
1610 | pts: 5 * 1000, | 1612 | pts: 5 * 1000, |
1611 | data: new Uint8Array([]), | 1613 | data: new Uint8Array([]), |
1612 | frames: [{ | 1614 | frames: [{ |
... | @@ -1699,10 +1701,10 @@ QUnit.skip('translates ID3 PTS values across discontinuities', function() { | ... | @@ -1699,10 +1701,10 @@ QUnit.skip('translates ID3 PTS values across discontinuities', function() { |
1699 | }); | 1701 | }); |
1700 | openMediaSource(player); | 1702 | openMediaSource(player); |
1701 | 1703 | ||
1702 | player.tech.hls.segmentParser_.parseSegmentBinaryData = function() { | 1704 | player.tech_.hls.segmentParser_.parseSegmentBinaryData = function() { |
1703 | // trigger a metadata event | 1705 | // trigger a metadata event |
1704 | if (events.length) { | 1706 | if (events.length) { |
1705 | player.tech.hls.segmentParser_.metadataStream.trigger('data', events.shift()); | 1707 | player.tech_.hls.segmentParser_.metadataStream.trigger('data', events.shift()); |
1706 | } | 1708 | } |
1707 | }; | 1709 | }; |
1708 | 1710 | ||
... | @@ -1740,7 +1742,7 @@ QUnit.skip('translates ID3 PTS values across discontinuities', function() { | ... | @@ -1740,7 +1742,7 @@ QUnit.skip('translates ID3 PTS values across discontinuities', function() { |
1740 | value: 'cue 1' | 1742 | value: 'cue 1' |
1741 | }] | 1743 | }] |
1742 | }); | 1744 | }); |
1743 | player.tech.hls.checkBuffer_(); | 1745 | player.tech_.hls.checkBuffer_(); |
1744 | standardXHRResponse(requests.shift()); | 1746 | standardXHRResponse(requests.shift()); |
1745 | 1747 | ||
1746 | track = player.textTracks()[0]; | 1748 | track = player.textTracks()[0]; |
... | @@ -1797,16 +1799,16 @@ test('adjusts the segment offsets for out-of-buffer seeking', function() { | ... | @@ -1797,16 +1799,16 @@ test('adjusts the segment offsets for out-of-buffer seeking', function() { |
1797 | }); | 1799 | }); |
1798 | openMediaSource(player); | 1800 | openMediaSource(player); |
1799 | standardXHRResponse(requests.shift()); // media | 1801 | standardXHRResponse(requests.shift()); // media |
1800 | player.tech.hls.sourceBuffer.buffered = function() { | 1802 | player.tech_.hls.sourceBuffer.buffered = function() { |
1801 | return videojs.createTimeRange(0, 20); | 1803 | return videojs.createTimeRange(0, 20); |
1802 | }; | 1804 | }; |
1803 | equal(player.tech.hls.mediaIndex, 0, 'starts at zero'); | 1805 | equal(player.tech_.hls.mediaIndex, 0, 'starts at zero'); |
1804 | 1806 | ||
1805 | player.tech.setCurrentTime(35); | 1807 | player.tech_.setCurrentTime(35); |
1806 | clock.tick(1); | 1808 | clock.tick(1); |
1807 | // drop the aborted segment | 1809 | // drop the aborted segment |
1808 | requests.shift(); | 1810 | requests.shift(); |
1809 | equal(player.tech.hls.mediaIndex, 3, 'moved the mediaIndex'); | 1811 | equal(player.tech_.hls.mediaIndex, 3, 'moved the mediaIndex'); |
1810 | standardXHRResponse(requests.shift()); | 1812 | standardXHRResponse(requests.shift()); |
1811 | }); | 1813 | }); |
1812 | 1814 | ||
... | @@ -1817,7 +1819,7 @@ test('seeks between buffered time ranges', function() { | ... | @@ -1817,7 +1819,7 @@ test('seeks between buffered time ranges', function() { |
1817 | }); | 1819 | }); |
1818 | openMediaSource(player); | 1820 | openMediaSource(player); |
1819 | standardXHRResponse(requests.shift()); // media | 1821 | standardXHRResponse(requests.shift()); // media |
1820 | player.tech.buffered = function() { | 1822 | player.tech_.buffered = function() { |
1821 | return { | 1823 | return { |
1822 | length: 2, | 1824 | length: 2, |
1823 | ranges_: [[0, 10], [20, 30]], | 1825 | ranges_: [[0, 10], [20, 30]], |
... | @@ -1830,11 +1832,11 @@ test('seeks between buffered time ranges', function() { | ... | @@ -1830,11 +1832,11 @@ test('seeks between buffered time ranges', function() { |
1830 | }; | 1832 | }; |
1831 | }; | 1833 | }; |
1832 | 1834 | ||
1833 | player.tech.setCurrentTime(15); | 1835 | player.tech_.setCurrentTime(15); |
1834 | clock.tick(1); | 1836 | clock.tick(1); |
1835 | // drop the aborted segment | 1837 | // drop the aborted segment |
1836 | requests.shift(); | 1838 | requests.shift(); |
1837 | equal(player.tech.hls.mediaIndex, 1, 'updated the mediaIndex'); | 1839 | equal(player.tech_.hls.mediaIndex, 1, 'updated the mediaIndex'); |
1838 | standardXHRResponse(requests.shift()); | 1840 | standardXHRResponse(requests.shift()); |
1839 | }); | 1841 | }); |
1840 | 1842 | ||
... | @@ -1846,14 +1848,14 @@ test('does not modify the media index for in-buffer seeking', function() { | ... | @@ -1846,14 +1848,14 @@ test('does not modify the media index for in-buffer seeking', function() { |
1846 | }); | 1848 | }); |
1847 | openMediaSource(player); | 1849 | openMediaSource(player); |
1848 | standardXHRResponse(requests.shift()); | 1850 | standardXHRResponse(requests.shift()); |
1849 | player.tech.buffered = function() { | 1851 | player.tech_.buffered = function() { |
1850 | return videojs.createTimeRange(0, 20); | 1852 | return videojs.createTimeRange(0, 20); |
1851 | }; | 1853 | }; |
1852 | mediaIndex = player.tech.hls.mediaIndex; | 1854 | mediaIndex = player.tech_.hls.mediaIndex; |
1853 | 1855 | ||
1854 | player.tech.setCurrentTime(11); | 1856 | player.tech_.setCurrentTime(11); |
1855 | clock.tick(1); | 1857 | clock.tick(1); |
1856 | equal(player.tech.hls.mediaIndex, mediaIndex, 'did not interrupt buffering'); | 1858 | equal(player.tech_.hls.mediaIndex, mediaIndex, 'did not interrupt buffering'); |
1857 | equal(requests.length, 1, 'did not abort the outstanding request'); | 1859 | equal(requests.length, 1, 'did not abort the outstanding request'); |
1858 | }); | 1860 | }); |
1859 | 1861 | ||
... | @@ -1865,7 +1867,7 @@ test('playlist 404 should end stream with a network error', function() { | ... | @@ -1865,7 +1867,7 @@ test('playlist 404 should end stream with a network error', function() { |
1865 | openMediaSource(player); | 1867 | openMediaSource(player); |
1866 | requests.pop().respond(404); | 1868 | requests.pop().respond(404); |
1867 | 1869 | ||
1868 | equal(player.tech.hls.mediaSource.error_, 'network', 'set a network error'); | 1870 | equal(player.tech_.hls.mediaSource.error_, 'network', 'set a network error'); |
1869 | }); | 1871 | }); |
1870 | 1872 | ||
1871 | test('segment 404 should trigger MEDIA_ERR_NETWORK', function () { | 1873 | test('segment 404 should trigger MEDIA_ERR_NETWORK', function () { |
... | @@ -1878,8 +1880,8 @@ test('segment 404 should trigger MEDIA_ERR_NETWORK', function () { | ... | @@ -1878,8 +1880,8 @@ test('segment 404 should trigger MEDIA_ERR_NETWORK', function () { |
1878 | 1880 | ||
1879 | standardXHRResponse(requests[0]); | 1881 | standardXHRResponse(requests[0]); |
1880 | requests[1].respond(404); | 1882 | requests[1].respond(404); |
1881 | ok(player.tech.hls.error.message, 'an error message is available'); | 1883 | ok(player.tech_.hls.error.message, 'an error message is available'); |
1882 | equal(2, player.tech.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK'); | 1884 | equal(2, player.tech_.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK'); |
1883 | }); | 1885 | }); |
1884 | 1886 | ||
1885 | test('segment 500 should trigger MEDIA_ERR_ABORTED', function () { | 1887 | test('segment 500 should trigger MEDIA_ERR_ABORTED', function () { |
... | @@ -1892,8 +1894,8 @@ test('segment 500 should trigger MEDIA_ERR_ABORTED', function () { | ... | @@ -1892,8 +1894,8 @@ test('segment 500 should trigger MEDIA_ERR_ABORTED', function () { |
1892 | 1894 | ||
1893 | standardXHRResponse(requests[0]); | 1895 | standardXHRResponse(requests[0]); |
1894 | requests[1].respond(500); | 1896 | requests[1].respond(500); |
1895 | ok(player.tech.hls.error.message, 'an error message is available'); | 1897 | ok(player.tech_.hls.error.message, 'an error message is available'); |
1896 | equal(4, player.tech.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_ABORTED'); | 1898 | equal(4, player.tech_.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_ABORTED'); |
1897 | }); | 1899 | }); |
1898 | 1900 | ||
1899 | test('seeking in an empty playlist is a non-erroring noop', function() { | 1901 | test('seeking in an empty playlist is a non-erroring noop', function() { |
... | @@ -1908,7 +1910,7 @@ test('seeking in an empty playlist is a non-erroring noop', function() { | ... | @@ -1908,7 +1910,7 @@ test('seeking in an empty playlist is a non-erroring noop', function() { |
1908 | requests.shift().respond(200, null, '#EXTM3U\n'); | 1910 | requests.shift().respond(200, null, '#EXTM3U\n'); |
1909 | 1911 | ||
1910 | requestsLength = requests.length; | 1912 | requestsLength = requests.length; |
1911 | player.tech.setCurrentTime(183); | 1913 | player.tech_.setCurrentTime(183); |
1912 | clock.tick(1); | 1914 | clock.tick(1); |
1913 | 1915 | ||
1914 | equal(requests.length, requestsLength, 'made no additional requests'); | 1916 | equal(requests.length, requestsLength, 'made no additional requests'); |
... | @@ -1923,7 +1925,7 @@ test('duration is Infinity for live playlists', function() { | ... | @@ -1923,7 +1925,7 @@ test('duration is Infinity for live playlists', function() { |
1923 | 1925 | ||
1924 | standardXHRResponse(requests[0]); | 1926 | standardXHRResponse(requests[0]); |
1925 | 1927 | ||
1926 | strictEqual(player.tech.hls.mediaSource.duration, | 1928 | strictEqual(player.tech_.hls.mediaSource.duration, |
1927 | Infinity, | 1929 | Infinity, |
1928 | 'duration is infinity'); | 1930 | 'duration is infinity'); |
1929 | }); | 1931 | }); |
... | @@ -1934,7 +1936,7 @@ test('updates the media index when a playlist reloads', function() { | ... | @@ -1934,7 +1936,7 @@ test('updates the media index when a playlist reloads', function() { |
1934 | type: 'application/vnd.apple.mpegurl' | 1936 | type: 'application/vnd.apple.mpegurl' |
1935 | }); | 1937 | }); |
1936 | openMediaSource(player); | 1938 | openMediaSource(player); |
1937 | player.tech.trigger('play'); | 1939 | player.tech_.trigger('play'); |
1938 | 1940 | ||
1939 | requests[0].respond(200, null, | 1941 | requests[0].respond(200, null, |
1940 | '#EXTM3U\n' + | 1942 | '#EXTM3U\n' + |
... | @@ -1946,9 +1948,9 @@ test('updates the media index when a playlist reloads', function() { | ... | @@ -1946,9 +1948,9 @@ test('updates the media index when a playlist reloads', function() { |
1946 | '2.ts\n'); | 1948 | '2.ts\n'); |
1947 | standardXHRResponse(requests[1]); | 1949 | standardXHRResponse(requests[1]); |
1948 | // play the stream until 2.ts is playing | 1950 | // play the stream until 2.ts is playing |
1949 | player.tech.hls.mediaIndex = 3; | 1951 | player.tech_.hls.mediaIndex = 3; |
1950 | // trigger a playlist refresh | 1952 | // trigger a playlist refresh |
1951 | player.tech.hls.playlists.trigger('mediaupdatetimeout'); | 1953 | player.tech_.hls.playlists.trigger('mediaupdatetimeout'); |
1952 | requests[2].respond(200, null, | 1954 | requests[2].respond(200, null, |
1953 | '#EXTM3U\n' + | 1955 | '#EXTM3U\n' + |
1954 | '#EXT-X-MEDIA-SEQUENCE:1\n' + | 1956 | '#EXT-X-MEDIA-SEQUENCE:1\n' + |
... | @@ -1959,7 +1961,7 @@ test('updates the media index when a playlist reloads', function() { | ... | @@ -1959,7 +1961,7 @@ test('updates the media index when a playlist reloads', function() { |
1959 | '#EXTINF:10,\n' + | 1961 | '#EXTINF:10,\n' + |
1960 | '3.ts\n'); | 1962 | '3.ts\n'); |
1961 | 1963 | ||
1962 | strictEqual(player.tech.hls.mediaIndex, 2, 'mediaIndex is updated after the reload'); | 1964 | strictEqual(player.tech_.hls.mediaIndex, 2, 'mediaIndex is updated after the reload'); |
1963 | }); | 1965 | }); |
1964 | 1966 | ||
1965 | test('live playlist starts three target durations before live', function() { | 1967 | test('live playlist starts three target durations before live', function() { |
... | @@ -1985,12 +1987,12 @@ test('live playlist starts three target durations before live', function() { | ... | @@ -1985,12 +1987,12 @@ test('live playlist starts three target durations before live', function() { |
1985 | 1987 | ||
1986 | equal(requests.length, 0, 'no outstanding segment request'); | 1988 | equal(requests.length, 0, 'no outstanding segment request'); |
1987 | 1989 | ||
1988 | player.tech.paused = function() { return false; }; | 1990 | player.tech_.paused = function() { return false; }; |
1989 | player.tech.trigger('play'); | 1991 | player.tech_.trigger('play'); |
1990 | clock.tick(1); | 1992 | clock.tick(1); |
1991 | mediaPlaylist = player.tech.hls.playlists.media(); | 1993 | mediaPlaylist = player.tech_.hls.playlists.media(); |
1992 | equal(player.tech.hls.mediaIndex, 1, 'mediaIndex is updated at play'); | 1994 | equal(player.tech_.hls.mediaIndex, 1, 'mediaIndex is updated at play'); |
1993 | equal(player.currentTime(), player.tech.hls.seekable().end(0), 'seeked to the seekable end'); | 1995 | equal(player.currentTime(), player.tech_.hls.seekable().end(0), 'seeked to the seekable end'); |
1994 | 1996 | ||
1995 | equal(requests.length, 1, 'begins buffering'); | 1997 | equal(requests.length, 1, 'begins buffering'); |
1996 | }); | 1998 | }); |
... | @@ -2022,14 +2024,14 @@ test('live playlist starts with correct currentTime value', function() { | ... | @@ -2022,14 +2024,14 @@ test('live playlist starts with correct currentTime value', function() { |
2022 | 2024 | ||
2023 | standardXHRResponse(requests[0]); | 2025 | standardXHRResponse(requests[0]); |
2024 | 2026 | ||
2025 | player.tech.hls.playlists.trigger('loadedmetadata'); | 2027 | player.tech_.hls.playlists.trigger('loadedmetadata'); |
2026 | 2028 | ||
2027 | player.tech.paused = function() { return false; }; | 2029 | player.tech_.paused = function() { return false; }; |
2028 | player.tech.trigger('play'); | 2030 | player.tech_.trigger('play'); |
2029 | clock.tick(1); | 2031 | clock.tick(1); |
2030 | 2032 | ||
2031 | strictEqual(player.currentTime(), | 2033 | strictEqual(player.currentTime(), |
2032 | videojs.Hls.Playlist.seekable(player.tech.hls.playlists.media()).end(0), | 2034 | videojs.Hls.Playlist.seekable(player.tech_.hls.playlists.media()).end(0), |
2033 | 'currentTime is updated at playback'); | 2035 | 'currentTime is updated at playback'); |
2034 | }); | 2036 | }); |
2035 | 2037 | ||
... | @@ -2048,22 +2050,22 @@ test('resets the time to a seekable position when resuming a live stream ' + | ... | @@ -2048,22 +2050,22 @@ test('resets the time to a seekable position when resuming a live stream ' + |
2048 | '16.ts\n'); | 2050 | '16.ts\n'); |
2049 | // mock out the player to simulate a live stream that has been | 2051 | // mock out the player to simulate a live stream that has been |
2050 | // playing for awhile | 2052 | // playing for awhile |
2051 | player.tech.hls.seekable = function() { | 2053 | player.tech_.hls.seekable = function() { |
2052 | return videojs.createTimeRange(160, 170); | 2054 | return videojs.createTimeRange(160, 170); |
2053 | }; | 2055 | }; |
2054 | player.tech.setCurrentTime = function(time) { | 2056 | player.tech_.setCurrentTime = function(time) { |
2055 | if (time !== undefined) { | 2057 | if (time !== undefined) { |
2056 | seekTarget = time; | 2058 | seekTarget = time; |
2057 | } | 2059 | } |
2058 | }; | 2060 | }; |
2059 | player.tech.played = function() { | 2061 | player.tech_.played = function() { |
2060 | return videojs.createTimeRange(120, 170); | 2062 | return videojs.createTimeRange(120, 170); |
2061 | }; | 2063 | }; |
2062 | player.tech.trigger('playing'); | 2064 | player.tech_.trigger('playing'); |
2063 | 2065 | ||
2064 | player.tech.trigger('play'); | 2066 | player.tech_.trigger('play'); |
2065 | equal(seekTarget, player.seekable().start(0), 'seeked to the start of seekable'); | 2067 | equal(seekTarget, player.seekable().start(0), 'seeked to the start of seekable'); |
2066 | player.tech.trigger('seeked'); | 2068 | player.tech_.trigger('seeked'); |
2067 | }); | 2069 | }); |
2068 | 2070 | ||
2069 | test('mediaIndex is zero before the first segment loads', function() { | 2071 | test('mediaIndex is zero before the first segment loads', function() { |
... | @@ -2077,7 +2079,7 @@ test('mediaIndex is zero before the first segment loads', function() { | ... | @@ -2077,7 +2079,7 @@ test('mediaIndex is zero before the first segment loads', function() { |
2077 | }); | 2079 | }); |
2078 | openMediaSource(player); | 2080 | openMediaSource(player); |
2079 | 2081 | ||
2080 | strictEqual(player.tech.hls.mediaIndex, 0, 'mediaIndex is zero'); | 2082 | strictEqual(player.tech_.hls.mediaIndex, 0, 'mediaIndex is zero'); |
2081 | }); | 2083 | }); |
2082 | 2084 | ||
2083 | test('mediaIndex returns correctly at playlist boundaries', function() { | 2085 | test('mediaIndex returns correctly at playlist boundaries', function() { |
... | @@ -2090,13 +2092,13 @@ test('mediaIndex returns correctly at playlist boundaries', function() { | ... | @@ -2090,13 +2092,13 @@ test('mediaIndex returns correctly at playlist boundaries', function() { |
2090 | standardXHRResponse(requests.shift()); // master | 2092 | standardXHRResponse(requests.shift()); // master |
2091 | standardXHRResponse(requests.shift()); // media | 2093 | standardXHRResponse(requests.shift()); // media |
2092 | 2094 | ||
2093 | strictEqual(player.tech.hls.mediaIndex, 0, 'mediaIndex is zero at first segment'); | 2095 | strictEqual(player.tech_.hls.mediaIndex, 0, 'mediaIndex is zero at first segment'); |
2094 | 2096 | ||
2095 | // seek to end | 2097 | // seek to end |
2096 | player.tech.setCurrentTime(40); | 2098 | player.tech_.setCurrentTime(40); |
2097 | clock.tick(1); | 2099 | clock.tick(1); |
2098 | 2100 | ||
2099 | strictEqual(player.tech.hls.mediaIndex, 3, 'mediaIndex is 3 at last segment'); | 2101 | strictEqual(player.tech_.hls.mediaIndex, 3, 'mediaIndex is 3 at last segment'); |
2100 | }); | 2102 | }); |
2101 | 2103 | ||
2102 | test('reloads out-of-date live playlists when switching variants', function() { | 2104 | test('reloads out-of-date live playlists when switching variants', function() { |
... | @@ -2106,7 +2108,7 @@ test('reloads out-of-date live playlists when switching variants', function() { | ... | @@ -2106,7 +2108,7 @@ test('reloads out-of-date live playlists when switching variants', function() { |
2106 | }); | 2108 | }); |
2107 | openMediaSource(player); | 2109 | openMediaSource(player); |
2108 | 2110 | ||
2109 | player.tech.hls.master = { | 2111 | player.tech_.hls.master = { |
2110 | playlists: [{ | 2112 | playlists: [{ |
2111 | mediaSequence: 15, | 2113 | mediaSequence: 15, |
2112 | segments: [1, 1, 1] | 2114 | segments: [1, 1, 1] |
... | @@ -2117,7 +2119,7 @@ test('reloads out-of-date live playlists when switching variants', function() { | ... | @@ -2117,7 +2119,7 @@ test('reloads out-of-date live playlists when switching variants', function() { |
2117 | }] | 2119 | }] |
2118 | }; | 2120 | }; |
2119 | // playing segment 15 on playlist zero | 2121 | // playing segment 15 on playlist zero |
2120 | player.tech.hls.media = player.tech.hls.master.playlists[0]; | 2122 | player.tech_.hls.media = player.tech_.hls.master.playlists[0]; |
2121 | player.mediaIndex = 1; | 2123 | player.mediaIndex = 1; |
2122 | window.manifests['variant-update'] = '#EXTM3U\n' + | 2124 | window.manifests['variant-update'] = '#EXTM3U\n' + |
2123 | '#EXT-X-MEDIA-SEQUENCE:16\n' + | 2125 | '#EXT-X-MEDIA-SEQUENCE:16\n' + |
... | @@ -2127,8 +2129,8 @@ test('reloads out-of-date live playlists when switching variants', function() { | ... | @@ -2127,8 +2129,8 @@ test('reloads out-of-date live playlists when switching variants', function() { |
2127 | '17.ts\n'; | 2129 | '17.ts\n'; |
2128 | 2130 | ||
2129 | // switch playlists | 2131 | // switch playlists |
2130 | player.tech.hls.selectPlaylist = function() { | 2132 | player.tech_.hls.selectPlaylist = function() { |
2131 | return player.tech.hls.master.playlists[1]; | 2133 | return player.tech_.hls.master.playlists[1]; |
2132 | }; | 2134 | }; |
2133 | // timeupdate downloads segment 16 then switches playlists | 2135 | // timeupdate downloads segment 16 then switches playlists |
2134 | player.trigger('timeupdate'); | 2136 | player.trigger('timeupdate'); |
... | @@ -2212,7 +2214,7 @@ test('clears the segment buffer on seek', function() { | ... | @@ -2212,7 +2214,7 @@ test('clears the segment buffer on seek', function() { |
2212 | } | 2214 | } |
2213 | return currentTime; | 2215 | return currentTime; |
2214 | }; | 2216 | }; |
2215 | player.tech.buffered = function() { | 2217 | player.tech_.buffered = function() { |
2216 | return videojs.createTimeRange(); | 2218 | return videojs.createTimeRange(); |
2217 | }; | 2219 | }; |
2218 | 2220 | ||
... | @@ -2232,12 +2234,12 @@ test('clears the segment buffer on seek', function() { | ... | @@ -2232,12 +2234,12 @@ test('clears the segment buffer on seek', function() { |
2232 | clock.tick(6000); | 2234 | clock.tick(6000); |
2233 | 2235 | ||
2234 | standardXHRResponse(requests.pop()); // 2.ts | 2236 | standardXHRResponse(requests.pop()); // 2.ts |
2235 | equal(player.tech.hls.segmentBuffer_.length, 2, 'started fetching segments'); | 2237 | equal(player.tech_.hls.segmentBuffer_.length, 2, 'started fetching segments'); |
2236 | 2238 | ||
2237 | // seek back to the beginning | 2239 | // seek back to the beginning |
2238 | player.currentTime(0); | 2240 | player.currentTime(0); |
2239 | clock.tick(1); | 2241 | clock.tick(1); |
2240 | equal(player.tech.hls.segmentBuffer_.length, 0, 'cleared the segment buffer'); | 2242 | equal(player.tech_.hls.segmentBuffer_.length, 0, 'cleared the segment buffer'); |
2241 | }); | 2243 | }); |
2242 | 2244 | ||
2243 | test('can seek before the source buffer opens', function() { | 2245 | test('can seek before the source buffer opens', function() { |
... | @@ -2245,7 +2247,7 @@ test('can seek before the source buffer opens', function() { | ... | @@ -2245,7 +2247,7 @@ test('can seek before the source buffer opens', function() { |
2245 | src: 'media.m3u8', | 2247 | src: 'media.m3u8', |
2246 | type: 'application/vnd.apple.mpegurl' | 2248 | type: 'application/vnd.apple.mpegurl' |
2247 | }); | 2249 | }); |
2248 | player.tech.triggerReady(); | 2250 | player.tech_.triggerReady(); |
2249 | clock.tick(1); | 2251 | clock.tick(1); |
2250 | standardXHRResponse(requests.shift()); | 2252 | standardXHRResponse(requests.shift()); |
2251 | player.triggerReady(); | 2253 | player.triggerReady(); |
... | @@ -2262,7 +2264,7 @@ QUnit.skip('sets the timestampOffset after seeking to discontinuity', function() | ... | @@ -2262,7 +2264,7 @@ QUnit.skip('sets the timestampOffset after seeking to discontinuity', function() |
2262 | type: 'application/vnd.apple.mpegurl' | 2264 | type: 'application/vnd.apple.mpegurl' |
2263 | }); | 2265 | }); |
2264 | openMediaSource(player); | 2266 | openMediaSource(player); |
2265 | player.tech.buffered = function() { | 2267 | player.tech_.buffered = function() { |
2266 | return videojs.createTimeRange(0, bufferEnd); | 2268 | return videojs.createTimeRange(0, bufferEnd); |
2267 | }; | 2269 | }; |
2268 | 2270 | ||
... | @@ -2277,13 +2279,13 @@ QUnit.skip('sets the timestampOffset after seeking to discontinuity', function() | ... | @@ -2277,13 +2279,13 @@ QUnit.skip('sets the timestampOffset after seeking to discontinuity', function() |
2277 | standardXHRResponse(requests.pop()); // 1.ts | 2279 | standardXHRResponse(requests.pop()); // 1.ts |
2278 | 2280 | ||
2279 | // seek to a discontinuity | 2281 | // seek to a discontinuity |
2280 | player.tech.setCurrentTime(10); | 2282 | player.tech_.setCurrentTime(10); |
2281 | bufferEnd = 9.9; | 2283 | bufferEnd = 9.9; |
2282 | clock.tick(1); | 2284 | clock.tick(1); |
2283 | standardXHRResponse(requests.pop()); // 1.ts | 2285 | standardXHRResponse(requests.pop()); // 1.ts |
2284 | player.tech.hls.checkBuffer_(); | 2286 | player.tech_.hls.checkBuffer_(); |
2285 | standardXHRResponse(requests.pop()); // 2.ts, again | 2287 | standardXHRResponse(requests.pop()); // 2.ts, again |
2286 | equal(player.tech.hls.sourceBuffer.timestampOffset, | 2288 | equal(player.tech_.hls.sourceBuffer.timestampOffset, |
2287 | 10, | 2289 | 10, |
2288 | 'set the timestamp offset'); | 2290 | 'set the timestamp offset'); |
2289 | }); | 2291 | }); |
... | @@ -2297,7 +2299,7 @@ QUnit.skip('tracks segment end times as they are buffered', function() { | ... | @@ -2297,7 +2299,7 @@ QUnit.skip('tracks segment end times as they are buffered', function() { |
2297 | openMediaSource(player); | 2299 | openMediaSource(player); |
2298 | 2300 | ||
2299 | // as new segments are downloaded, the buffer end is updated | 2301 | // as new segments are downloaded, the buffer end is updated |
2300 | player.tech.buffered = function() { | 2302 | player.tech_.buffered = function() { |
2301 | return videojs.createTimeRange(0, bufferEnd); | 2303 | return videojs.createTimeRange(0, bufferEnd); |
2302 | }; | 2304 | }; |
2303 | requests.shift().respond(200, null, | 2305 | requests.shift().respond(200, null, |
... | @@ -2310,13 +2312,13 @@ QUnit.skip('tracks segment end times as they are buffered', function() { | ... | @@ -2310,13 +2312,13 @@ QUnit.skip('tracks segment end times as they are buffered', function() { |
2310 | 2312 | ||
2311 | // 0.ts is shorter than advertised | 2313 | // 0.ts is shorter than advertised |
2312 | standardXHRResponse(requests.shift()); | 2314 | standardXHRResponse(requests.shift()); |
2313 | equal(player.tech.hls.mediaSource.duration, 20, 'original duration is from the m3u8'); | 2315 | equal(player.tech_.hls.mediaSource.duration, 20, 'original duration is from the m3u8'); |
2314 | 2316 | ||
2315 | bufferEnd = 9.5; | 2317 | bufferEnd = 9.5; |
2316 | player.tech.hls.sourceBuffer.trigger('update'); | 2318 | player.tech_.hls.sourceBuffer.trigger('update'); |
2317 | player.tech.hls.sourceBuffer.trigger('updateend'); | 2319 | player.tech_.hls.sourceBuffer.trigger('updateend'); |
2318 | equal(player.tech.duration(), 10 + 9.5, 'updated duration'); | 2320 | equal(player.tech_.duration(), 10 + 9.5, 'updated duration'); |
2319 | equal(player.tech.hls.appendingSegmentInfo_, null, 'cleared the appending segment'); | 2321 | equal(player.tech_.hls.appendingSegmentInfo_, null, 'cleared the appending segment'); |
2320 | }); | 2322 | }); |
2321 | 2323 | ||
2322 | QUnit.skip('seeking does not fail when targeted between segments', function() { | 2324 | QUnit.skip('seeking does not fail when targeted between segments', function() { |
... | @@ -2328,12 +2330,12 @@ QUnit.skip('seeking does not fail when targeted between segments', function() { | ... | @@ -2328,12 +2330,12 @@ QUnit.skip('seeking does not fail when targeted between segments', function() { |
2328 | openMediaSource(player); | 2330 | openMediaSource(player); |
2329 | 2331 | ||
2330 | // mock out the currentTime callbacks | 2332 | // mock out the currentTime callbacks |
2331 | player.tech.el().vjs_setProperty = function(property, value) { | 2333 | player.tech_.el().vjs_setProperty = function(property, value) { |
2332 | if (property === 'currentTime') { | 2334 | if (property === 'currentTime') { |
2333 | currentTime = value; | 2335 | currentTime = value; |
2334 | } | 2336 | } |
2335 | }; | 2337 | }; |
2336 | player.tech.el().vjs_getProperty = function(property) { | 2338 | player.tech_.el().vjs_getProperty = function(property) { |
2337 | if (property === 'currentTime') { | 2339 | if (property === 'currentTime') { |
2338 | return currentTime; | 2340 | return currentTime; |
2339 | } | 2341 | } |
... | @@ -2341,7 +2343,7 @@ QUnit.skip('seeking does not fail when targeted between segments', function() { | ... | @@ -2341,7 +2343,7 @@ QUnit.skip('seeking does not fail when targeted between segments', function() { |
2341 | 2343 | ||
2342 | standardXHRResponse(requests.shift()); // media | 2344 | standardXHRResponse(requests.shift()); // media |
2343 | standardXHRResponse(requests.shift()); // segment 0 | 2345 | standardXHRResponse(requests.shift()); // segment 0 |
2344 | player.tech.hls.checkBuffer_(); | 2346 | player.tech_.hls.checkBuffer_(); |
2345 | segmentUrl = requests[0].url; | 2347 | segmentUrl = requests[0].url; |
2346 | standardXHRResponse(requests.shift()); // segment 1 | 2348 | standardXHRResponse(requests.shift()); // segment 1 |
2347 | 2349 | ||
... | @@ -2349,12 +2351,12 @@ QUnit.skip('seeking does not fail when targeted between segments', function() { | ... | @@ -2349,12 +2351,12 @@ QUnit.skip('seeking does not fail when targeted between segments', function() { |
2349 | // less than the first in segment 1 | 2351 | // less than the first in segment 1 |
2350 | // FIXME: it's not possible to seek here without timestamp-based | 2352 | // FIXME: it's not possible to seek here without timestamp-based |
2351 | // segment durations | 2353 | // segment durations |
2352 | player.tech.setCurrentTime(9.4); | 2354 | player.tech_.setCurrentTime(9.4); |
2353 | clock.tick(1); | 2355 | clock.tick(1); |
2354 | equal(requests[0].url, segmentUrl, 'requested the later segment'); | 2356 | equal(requests[0].url, segmentUrl, 'requested the later segment'); |
2355 | 2357 | ||
2356 | standardXHRResponse(requests.shift()); // segment 1 | 2358 | standardXHRResponse(requests.shift()); // segment 1 |
2357 | player.tech.trigger('seeked'); | 2359 | player.tech_.trigger('seeked'); |
2358 | equal(player.currentTime(), 9.5, 'seeked to the later time'); | 2360 | equal(player.currentTime(), 9.5, 'seeked to the later time'); |
2359 | }); | 2361 | }); |
2360 | 2362 | ||
... | @@ -2364,7 +2366,7 @@ test('resets the switching algorithm if a request times out', function() { | ... | @@ -2364,7 +2366,7 @@ test('resets the switching algorithm if a request times out', function() { |
2364 | type: 'application/vnd.apple.mpegurl' | 2366 | type: 'application/vnd.apple.mpegurl' |
2365 | }); | 2367 | }); |
2366 | openMediaSource(player); | 2368 | openMediaSource(player); |
2367 | player.tech.hls.bandwidth = 20000; | 2369 | player.tech_.hls.bandwidth = 20000; |
2368 | 2370 | ||
2369 | standardXHRResponse(requests.shift()); // master | 2371 | standardXHRResponse(requests.shift()); // master |
2370 | standardXHRResponse(requests.shift()); // media.m3u8 | 2372 | standardXHRResponse(requests.shift()); // media.m3u8 |
... | @@ -2374,8 +2376,8 @@ test('resets the switching algorithm if a request times out', function() { | ... | @@ -2374,8 +2376,8 @@ test('resets the switching algorithm if a request times out', function() { |
2374 | 2376 | ||
2375 | standardXHRResponse(requests.shift()); | 2377 | standardXHRResponse(requests.shift()); |
2376 | 2378 | ||
2377 | strictEqual(player.tech.hls.playlists.media(), | 2379 | strictEqual(player.tech_.hls.playlists.media(), |
2378 | player.tech.hls.playlists.master.playlists[1], | 2380 | player.tech_.hls.playlists.master.playlists[1], |
2379 | 'reset to the lowest bitrate playlist'); | 2381 | 'reset to the lowest bitrate playlist'); |
2380 | }); | 2382 | }); |
2381 | 2383 | ||
... | @@ -2387,10 +2389,10 @@ test('disposes the playlist loader', function() { | ... | @@ -2387,10 +2389,10 @@ test('disposes the playlist loader', function() { |
2387 | type: 'application/vnd.apple.mpegurl' | 2389 | type: 'application/vnd.apple.mpegurl' |
2388 | }); | 2390 | }); |
2389 | openMediaSource(player); | 2391 | openMediaSource(player); |
2390 | loaderDispose = player.tech.hls.playlists.dispose; | 2392 | loaderDispose = player.tech_.hls.playlists.dispose; |
2391 | player.tech.hls.playlists.dispose = function() { | 2393 | player.tech_.hls.playlists.dispose = function() { |
2392 | disposes++; | 2394 | disposes++; |
2393 | loaderDispose.call(player.tech.hls.playlists); | 2395 | loaderDispose.call(player.tech_.hls.playlists); |
2394 | }; | 2396 | }; |
2395 | 2397 | ||
2396 | player.dispose(); | 2398 | player.dispose(); |
... | @@ -2446,7 +2448,7 @@ test('aborts the source buffer on disposal', function() { | ... | @@ -2446,7 +2448,7 @@ test('aborts the source buffer on disposal', function() { |
2446 | }); | 2448 | }); |
2447 | openMediaSource(player); | 2449 | openMediaSource(player); |
2448 | standardXHRResponse(requests.shift()); | 2450 | standardXHRResponse(requests.shift()); |
2449 | player.tech.hls.sourceBuffer.abort = function() { | 2451 | player.tech_.hls.sourceBuffer.abort = function() { |
2450 | aborts++; | 2452 | aborts++; |
2451 | }; | 2453 | }; |
2452 | 2454 | ||
... | @@ -2479,7 +2481,7 @@ test('has no effect if native HLS is available', function() { | ... | @@ -2479,7 +2481,7 @@ test('has no effect if native HLS is available', function() { |
2479 | type: 'application/x-mpegURL' | 2481 | type: 'application/x-mpegURL' |
2480 | }); | 2482 | }); |
2481 | 2483 | ||
2482 | ok(!player.tech.hls, 'did not load hls tech'); | 2484 | ok(!player.tech_.hls, 'did not load hls tech'); |
2483 | player.dispose(); | 2485 | player.dispose(); |
2484 | }); | 2486 | }); |
2485 | 2487 | ||
... | @@ -2499,7 +2501,7 @@ test('tracks the bytes downloaded', function() { | ... | @@ -2499,7 +2501,7 @@ test('tracks the bytes downloaded', function() { |
2499 | }); | 2501 | }); |
2500 | openMediaSource(player); | 2502 | openMediaSource(player); |
2501 | 2503 | ||
2502 | strictEqual(player.tech.hls.bytesReceived, 0, 'no bytes received'); | 2504 | strictEqual(player.tech_.hls.bytesReceived, 0, 'no bytes received'); |
2503 | 2505 | ||
2504 | requests.shift().respond(200, null, | 2506 | requests.shift().respond(200, null, |
2505 | '#EXTM3U\n' + | 2507 | '#EXTM3U\n' + |
... | @@ -2512,15 +2514,15 @@ test('tracks the bytes downloaded', function() { | ... | @@ -2512,15 +2514,15 @@ test('tracks the bytes downloaded', function() { |
2512 | requests[0].response = new ArrayBuffer(17); | 2514 | requests[0].response = new ArrayBuffer(17); |
2513 | requests.shift().respond(200, null, ''); | 2515 | requests.shift().respond(200, null, ''); |
2514 | 2516 | ||
2515 | strictEqual(player.tech.hls.bytesReceived, 17, 'tracked bytes received'); | 2517 | strictEqual(player.tech_.hls.bytesReceived, 17, 'tracked bytes received'); |
2516 | 2518 | ||
2517 | player.tech.hls.checkBuffer_(); | 2519 | player.tech_.hls.checkBuffer_(); |
2518 | 2520 | ||
2519 | // transmit some more | 2521 | // transmit some more |
2520 | requests[0].response = new ArrayBuffer(5); | 2522 | requests[0].response = new ArrayBuffer(5); |
2521 | requests.shift().respond(200, null, ''); | 2523 | requests.shift().respond(200, null, ''); |
2522 | 2524 | ||
2523 | strictEqual(player.tech.hls.bytesReceived, 22, 'tracked more bytes'); | 2525 | strictEqual(player.tech_.hls.bytesReceived, 22, 'tracked more bytes'); |
2524 | }); | 2526 | }); |
2525 | 2527 | ||
2526 | test('re-emits mediachange events', function() { | 2528 | test('re-emits mediachange events', function() { |
... | @@ -2535,12 +2537,12 @@ test('re-emits mediachange events', function() { | ... | @@ -2535,12 +2537,12 @@ test('re-emits mediachange events', function() { |
2535 | }); | 2537 | }); |
2536 | openMediaSource(player); | 2538 | openMediaSource(player); |
2537 | 2539 | ||
2538 | player.tech.hls.playlists.trigger('mediachange'); | 2540 | player.tech_.hls.playlists.trigger('mediachange'); |
2539 | strictEqual(mediaChanges, 1, 'fired mediachange'); | 2541 | strictEqual(mediaChanges, 1, 'fired mediachange'); |
2540 | }); | 2542 | }); |
2541 | 2543 | ||
2542 | test('can be disposed before finishing initialization', function() { | 2544 | test('can be disposed before finishing initialization', function() { |
2543 | var player = createPlayer(), readyHandlers = []; | 2545 | var readyHandlers = []; |
2544 | player.ready = function(callback) { | 2546 | player.ready = function(callback) { |
2545 | readyHandlers.push(callback); | 2547 | readyHandlers.push(callback); |
2546 | }; | 2548 | }; |
... | @@ -2556,6 +2558,7 @@ test('can be disposed before finishing initialization', function() { | ... | @@ -2556,6 +2558,7 @@ test('can be disposed before finishing initialization', function() { |
2556 | try { | 2558 | try { |
2557 | while (readyHandlers.length) { | 2559 | while (readyHandlers.length) { |
2558 | readyHandlers.shift().call(player); | 2560 | readyHandlers.shift().call(player); |
2561 | openMediaSource(player); | ||
2559 | } | 2562 | } |
2560 | ok(true, 'did not throw an exception'); | 2563 | ok(true, 'did not throw an exception'); |
2561 | } catch (e) { | 2564 | } catch (e) { |
... | @@ -2570,7 +2573,7 @@ test('calls ended() on the media source at the end of a playlist', function() { | ... | @@ -2570,7 +2573,7 @@ test('calls ended() on the media source at the end of a playlist', function() { |
2570 | type: 'application/vnd.apple.mpegurl' | 2573 | type: 'application/vnd.apple.mpegurl' |
2571 | }); | 2574 | }); |
2572 | openMediaSource(player); | 2575 | openMediaSource(player); |
2573 | player.tech.hls.mediaSource.endOfStream = function() { | 2576 | player.tech_.hls.mediaSource.endOfStream = function() { |
2574 | endOfStreams++; | 2577 | endOfStreams++; |
2575 | }; | 2578 | }; |
2576 | // playlist response | 2579 | // playlist response |
... | @@ -2584,7 +2587,7 @@ test('calls ended() on the media source at the end of a playlist', function() { | ... | @@ -2584,7 +2587,7 @@ test('calls ended() on the media source at the end of a playlist', function() { |
2584 | requests.shift().respond(200, null, ''); | 2587 | requests.shift().respond(200, null, ''); |
2585 | strictEqual(endOfStreams, 0, 'waits for the buffer update to finish'); | 2588 | strictEqual(endOfStreams, 0, 'waits for the buffer update to finish'); |
2586 | 2589 | ||
2587 | player.tech.hls.sourceBuffer.trigger('updateend'); | 2590 | player.tech_.hls.sourceBuffer.trigger('updateend'); |
2588 | strictEqual(endOfStreams, 1, 'ended media source'); | 2591 | strictEqual(endOfStreams, 1, 'ended media source'); |
2589 | }); | 2592 | }); |
2590 | 2593 | ||
... | @@ -2601,13 +2604,13 @@ test('calling play() at the end of a video resets the media index', function() { | ... | @@ -2601,13 +2604,13 @@ test('calling play() at the end of a video resets the media index', function() { |
2601 | '#EXT-X-ENDLIST\n'); | 2604 | '#EXT-X-ENDLIST\n'); |
2602 | standardXHRResponse(requests.shift()); | 2605 | standardXHRResponse(requests.shift()); |
2603 | 2606 | ||
2604 | strictEqual(player.tech.hls.mediaIndex, 1, 'index is 1 after the first segment'); | 2607 | strictEqual(player.tech_.hls.mediaIndex, 1, 'index is 1 after the first segment'); |
2605 | player.tech.ended = function() { | 2608 | player.tech_.ended = function() { |
2606 | return true; | 2609 | return true; |
2607 | }; | 2610 | }; |
2608 | 2611 | ||
2609 | player.tech.trigger('play'); | 2612 | player.tech_.trigger('play'); |
2610 | strictEqual(player.tech.hls.mediaIndex, 0, 'index is 0 after the first segment'); | 2613 | strictEqual(player.tech_.hls.mediaIndex, 0, 'index is 0 after the first segment'); |
2611 | }); | 2614 | }); |
2612 | 2615 | ||
2613 | test('drainBuffer will not proceed with empty source buffer', function() { | 2616 | test('drainBuffer will not proceed with empty source buffer', function() { |
... | @@ -2618,7 +2621,7 @@ test('drainBuffer will not proceed with empty source buffer', function() { | ... | @@ -2618,7 +2621,7 @@ test('drainBuffer will not proceed with empty source buffer', function() { |
2618 | }); | 2621 | }); |
2619 | openMediaSource(player); | 2622 | openMediaSource(player); |
2620 | 2623 | ||
2621 | oldMedia = player.tech.hls.playlists.media; | 2624 | oldMedia = player.tech_.hls.playlists.media; |
2622 | newMedia = {segments: [{ | 2625 | newMedia = {segments: [{ |
2623 | key: { | 2626 | key: { |
2624 | 'retries': 5 | 2627 | 'retries': 5 |
... | @@ -2631,23 +2634,23 @@ test('drainBuffer will not proceed with empty source buffer', function() { | ... | @@ -2631,23 +2634,23 @@ test('drainBuffer will not proceed with empty source buffer', function() { |
2631 | }, | 2634 | }, |
2632 | uri: 'http://media.example.com/fileSequence53-B.ts' | 2635 | uri: 'http://media.example.com/fileSequence53-B.ts' |
2633 | }]}; | 2636 | }]}; |
2634 | player.tech.hls.playlists.media = function() { | 2637 | player.tech_.hls.playlists.media = function() { |
2635 | return newMedia; | 2638 | return newMedia; |
2636 | }; | 2639 | }; |
2637 | 2640 | ||
2638 | player.tech.hls.sourceBuffer = undefined; | 2641 | player.tech_.hls.sourceBuffer = undefined; |
2639 | compareBuffer = [{mediaIndex: 0, playlist: newMedia, offset: 0, bytes: new Uint8Array(3)}]; | 2642 | compareBuffer = [{mediaIndex: 0, playlist: newMedia, offset: 0, bytes: new Uint8Array(3)}]; |
2640 | player.tech.hls.segmentBuffer_ = [{mediaIndex: 0, playlist: newMedia, offset: 0, bytes: new Uint8Array(3)}]; | 2643 | player.tech_.hls.segmentBuffer_ = [{mediaIndex: 0, playlist: newMedia, offset: 0, bytes: new Uint8Array(3)}]; |
2641 | 2644 | ||
2642 | player.tech.hls.drainBuffer(); | 2645 | player.tech_.hls.drainBuffer(); |
2643 | 2646 | ||
2644 | /* Normally, drainBuffer() calls segmentBuffer.shift(), removing a segment from the stack. | 2647 | /* Normally, drainBuffer() calls segmentBuffer.shift(), removing a segment from the stack. |
2645 | * Comparing two buffers to ensure no segment was popped verifies that we returned early | 2648 | * Comparing two buffers to ensure no segment was popped verifies that we returned early |
2646 | * from drainBuffer() because sourceBuffer was empty. | 2649 | * from drainBuffer() because sourceBuffer was empty. |
2647 | */ | 2650 | */ |
2648 | deepEqual(player.tech.hls.segmentBuffer_, compareBuffer, 'playlist remains unchanged'); | 2651 | deepEqual(player.tech_.hls.segmentBuffer_, compareBuffer, 'playlist remains unchanged'); |
2649 | 2652 | ||
2650 | player.tech.hls.playlists.media = oldMedia; | 2653 | player.tech_.hls.playlists.media = oldMedia; |
2651 | }); | 2654 | }); |
2652 | 2655 | ||
2653 | test('keys are requested when an encrypted segment is loaded', function() { | 2656 | test('keys are requested when an encrypted segment is loaded', function() { |
... | @@ -2656,13 +2659,13 @@ test('keys are requested when an encrypted segment is loaded', function() { | ... | @@ -2656,13 +2659,13 @@ test('keys are requested when an encrypted segment is loaded', function() { |
2656 | type: 'application/vnd.apple.mpegurl' | 2659 | type: 'application/vnd.apple.mpegurl' |
2657 | }); | 2660 | }); |
2658 | openMediaSource(player); | 2661 | openMediaSource(player); |
2659 | player.tech.trigger('play'); | 2662 | player.tech_.trigger('play'); |
2660 | standardXHRResponse(requests.shift()); // playlist | 2663 | standardXHRResponse(requests.shift()); // playlist |
2661 | standardXHRResponse(requests.shift()); // first segment | 2664 | standardXHRResponse(requests.shift()); // first segment |
2662 | 2665 | ||
2663 | strictEqual(requests.length, 1, 'a key XHR is created'); | 2666 | strictEqual(requests.length, 1, 'a key XHR is created'); |
2664 | strictEqual(requests[0].url, | 2667 | strictEqual(requests[0].url, |
2665 | player.tech.hls.playlists.media().segments[0].key.uri, | 2668 | player.tech_.hls.playlists.media().segments[0].key.uri, |
2666 | 'a key XHR is created with correct uri'); | 2669 | 'a key XHR is created with correct uri'); |
2667 | }); | 2670 | }); |
2668 | 2671 | ||
... | @@ -2730,15 +2733,15 @@ test('a new key XHR is created when a the segment is received', function() { | ... | @@ -2730,15 +2733,15 @@ test('a new key XHR is created when a the segment is received', function() { |
2730 | standardXHRResponse(requests.shift()); // segment 1 | 2733 | standardXHRResponse(requests.shift()); // segment 1 |
2731 | standardXHRResponse(requests.shift()); // key 1 | 2734 | standardXHRResponse(requests.shift()); // key 1 |
2732 | // "finish" decrypting segment 1 | 2735 | // "finish" decrypting segment 1 |
2733 | player.tech.hls.segmentBuffer_[0].bytes = new Uint8Array(16); | 2736 | player.tech_.hls.segmentBuffer_[0].bytes = new Uint8Array(16); |
2734 | player.tech.hls.checkBuffer_(); | 2737 | player.tech_.hls.checkBuffer_(); |
2735 | 2738 | ||
2736 | standardXHRResponse(requests.shift()); // segment 2 | 2739 | standardXHRResponse(requests.shift()); // segment 2 |
2737 | 2740 | ||
2738 | strictEqual(requests.length, 1, 'a key XHR is created'); | 2741 | strictEqual(requests.length, 1, 'a key XHR is created'); |
2739 | strictEqual(requests[0].url, | 2742 | strictEqual(requests[0].url, |
2740 | 'https://example.com/' + | 2743 | 'https://example.com/' + |
2741 | player.tech.hls.playlists.media().segments[1].key.uri, | 2744 | player.tech_.hls.playlists.media().segments[1].key.uri, |
2742 | 'a key XHR is created with the correct uri'); | 2745 | 'a key XHR is created with the correct uri'); |
2743 | }); | 2746 | }); |
2744 | 2747 | ||
... | @@ -2771,7 +2774,7 @@ test('seeking should abort an outstanding key request and create a new one', fun | ... | @@ -2771,7 +2774,7 @@ test('seeking should abort an outstanding key request and create a new one', fun |
2771 | equal(requests.length, 1, 'requested the new key'); | 2774 | equal(requests.length, 1, 'requested the new key'); |
2772 | equal(requests[0].url, | 2775 | equal(requests[0].url, |
2773 | 'https://example.com/' + | 2776 | 'https://example.com/' + |
2774 | player.tech.hls.playlists.media().segments[1].key.uri, | 2777 | player.tech_.hls.playlists.media().segments[1].key.uri, |
2775 | 'urls should match'); | 2778 | 'urls should match'); |
2776 | }); | 2779 | }); |
2777 | 2780 | ||
... | @@ -2781,7 +2784,7 @@ test('retries key requests once upon failure', function() { | ... | @@ -2781,7 +2784,7 @@ test('retries key requests once upon failure', function() { |
2781 | type: 'application/vnd.apple.mpegurl' | 2784 | type: 'application/vnd.apple.mpegurl' |
2782 | }); | 2785 | }); |
2783 | openMediaSource(player); | 2786 | openMediaSource(player); |
2784 | player.tech.trigger('play'); | 2787 | player.tech_.trigger('play'); |
2785 | 2788 | ||
2786 | requests.shift().respond(200, null, | 2789 | requests.shift().respond(200, null, |
2787 | '#EXTM3U\n' + | 2790 | '#EXTM3U\n' + |
... | @@ -2808,7 +2811,7 @@ test('skip segments if key requests fail more than once', function() { | ... | @@ -2808,7 +2811,7 @@ test('skip segments if key requests fail more than once', function() { |
2808 | type: 'application/vnd.apple.mpegurl' | 2811 | type: 'application/vnd.apple.mpegurl' |
2809 | }); | 2812 | }); |
2810 | openMediaSource(player); | 2813 | openMediaSource(player); |
2811 | player.tech.trigger('play'); | 2814 | player.tech_.trigger('play'); |
2812 | 2815 | ||
2813 | requests.shift().respond(200, null, | 2816 | requests.shift().respond(200, null, |
2814 | '#EXTM3U\n' + | 2817 | '#EXTM3U\n' + |
... | @@ -2818,14 +2821,14 @@ test('skip segments if key requests fail more than once', function() { | ... | @@ -2818,14 +2821,14 @@ test('skip segments if key requests fail more than once', function() { |
2818 | '#EXT-X-KEY:METHOD=AES-128,URI="htts://priv.example.com/key.php?r=53"\n' + | 2821 | '#EXT-X-KEY:METHOD=AES-128,URI="htts://priv.example.com/key.php?r=53"\n' + |
2819 | '#EXTINF:15.0,\n' + | 2822 | '#EXTINF:15.0,\n' + |
2820 | 'http://media.example.com/fileSequence53-A.ts\n'); | 2823 | 'http://media.example.com/fileSequence53-A.ts\n'); |
2821 | player.tech.hls.sourceBuffer.appendBuffer = function(chunk) { | 2824 | player.tech_.hls.sourceBuffer.appendBuffer = function(chunk) { |
2822 | bytes.push(chunk); | 2825 | bytes.push(chunk); |
2823 | }; | 2826 | }; |
2824 | standardXHRResponse(requests.shift()); // segment 1 | 2827 | standardXHRResponse(requests.shift()); // segment 1 |
2825 | requests.shift().respond(404); // fail key | 2828 | requests.shift().respond(404); // fail key |
2826 | requests.shift().respond(404); // fail key, again | 2829 | requests.shift().respond(404); // fail key, again |
2827 | 2830 | ||
2828 | player.tech.hls.checkBuffer_(); | 2831 | player.tech_.hls.checkBuffer_(); |
2829 | standardXHRResponse(requests.shift()); // segment 2 | 2832 | standardXHRResponse(requests.shift()); // segment 2 |
2830 | equal(bytes.length, 0, 'did not append encrypted bytes'); | 2833 | equal(bytes.length, 0, 'did not append encrypted bytes'); |
2831 | 2834 | ||
... | @@ -2833,8 +2836,8 @@ test('skip segments if key requests fail more than once', function() { | ... | @@ -2833,8 +2836,8 @@ test('skip segments if key requests fail more than once', function() { |
2833 | requests[0].response = new Uint32Array([0,0,0,0]).buffer; | 2836 | requests[0].response = new Uint32Array([0,0,0,0]).buffer; |
2834 | requests.shift().respond(200, null, ''); | 2837 | requests.shift().respond(200, null, ''); |
2835 | // "finish" decryption | 2838 | // "finish" decryption |
2836 | player.tech.hls.segmentBuffer_[0].bytes = new Uint8Array(16); | 2839 | player.tech_.hls.segmentBuffer_[0].bytes = new Uint8Array(16); |
2837 | player.tech.hls.checkBuffer_(); | 2840 | player.tech_.hls.checkBuffer_(); |
2838 | 2841 | ||
2839 | equal(bytes.length, 1, 'appended cleartext bytes from the second segment'); | 2842 | equal(bytes.length, 1, 'appended cleartext bytes from the second segment'); |
2840 | deepEqual(bytes[0], new Uint8Array(16), 'appended bytes from the second segment, not the first'); | 2843 | deepEqual(bytes[0], new Uint8Array(16), 'appended bytes from the second segment, not the first'); |
... | @@ -2848,7 +2851,7 @@ test('the key is supplied to the decrypter in the correct format', function() { | ... | @@ -2848,7 +2851,7 @@ test('the key is supplied to the decrypter in the correct format', function() { |
2848 | type: 'application/vnd.apple.mpegurl' | 2851 | type: 'application/vnd.apple.mpegurl' |
2849 | }); | 2852 | }); |
2850 | openMediaSource(player); | 2853 | openMediaSource(player); |
2851 | player.tech.trigger('play'); | 2854 | player.tech_.trigger('play'); |
2852 | 2855 | ||
2853 | requests.pop().respond(200, null, | 2856 | requests.pop().respond(200, null, |
2854 | '#EXTM3U\n' + | 2857 | '#EXTM3U\n' + |
... | @@ -2883,7 +2886,7 @@ test('supplies the media sequence of current segment as the IV by default, if no | ... | @@ -2883,7 +2886,7 @@ test('supplies the media sequence of current segment as the IV by default, if no |
2883 | type: 'application/vnd.apple.mpegurl' | 2886 | type: 'application/vnd.apple.mpegurl' |
2884 | }); | 2887 | }); |
2885 | openMediaSource(player); | 2888 | openMediaSource(player); |
2886 | player.tech.trigger('play'); | 2889 | player.tech_.trigger('play'); |
2887 | 2890 | ||
2888 | requests.pop().respond(200, null, | 2891 | requests.pop().respond(200, null, |
2889 | '#EXTM3U\n' + | 2892 | '#EXTM3U\n' + |
... | @@ -2923,15 +2926,15 @@ test('switching playlists with an outstanding key request does not stall playbac | ... | @@ -2923,15 +2926,15 @@ test('switching playlists with an outstanding key request does not stall playbac |
2923 | type: 'application/vnd.apple.mpegurl' | 2926 | type: 'application/vnd.apple.mpegurl' |
2924 | }); | 2927 | }); |
2925 | openMediaSource(player); | 2928 | openMediaSource(player); |
2926 | player.tech.trigger('play'); | 2929 | player.tech_.trigger('play'); |
2927 | 2930 | ||
2928 | // master playlist | 2931 | // master playlist |
2929 | standardXHRResponse(requests.shift()); | 2932 | standardXHRResponse(requests.shift()); |
2930 | // media playlist | 2933 | // media playlist |
2931 | requests.shift().respond(200, null, media); | 2934 | requests.shift().respond(200, null, media); |
2932 | // mock out media switching from this point on | 2935 | // mock out media switching from this point on |
2933 | player.tech.hls.playlists.media = function() { | 2936 | player.tech_.hls.playlists.media = function() { |
2934 | return player.tech.hls.playlists.master.playlists[0]; | 2937 | return player.tech_.hls.playlists.master.playlists[0]; |
2935 | }; | 2938 | }; |
2936 | // first segment of the original media playlist | 2939 | // first segment of the original media playlist |
2937 | standardXHRResponse(requests.shift()); | 2940 | standardXHRResponse(requests.shift()); |
... | @@ -2939,9 +2942,9 @@ test('switching playlists with an outstanding key request does not stall playbac | ... | @@ -2939,9 +2942,9 @@ test('switching playlists with an outstanding key request does not stall playbac |
2939 | requests.shift(); | 2942 | requests.shift(); |
2940 | 2943 | ||
2941 | // "switch" media | 2944 | // "switch" media |
2942 | player.tech.hls.playlists.trigger('mediachange'); | 2945 | player.tech_.hls.playlists.trigger('mediachange'); |
2943 | 2946 | ||
2944 | player.tech.hls.checkBuffer_(); | 2947 | player.tech_.hls.checkBuffer_(); |
2945 | 2948 | ||
2946 | ok(requests.length, 'made a request'); | 2949 | ok(requests.length, 'made a request'); |
2947 | equal(requests[0].url, | 2950 | equal(requests[0].url, |
... | @@ -2978,7 +2981,7 @@ test('treats invalid keys as a key request failure', function() { | ... | @@ -2978,7 +2981,7 @@ test('treats invalid keys as a key request failure', function() { |
2978 | type: 'application/vnd.apple.mpegurl' | 2981 | type: 'application/vnd.apple.mpegurl' |
2979 | }); | 2982 | }); |
2980 | openMediaSource(player); | 2983 | openMediaSource(player); |
2981 | player.tech.trigger('play'); | 2984 | player.tech_.trigger('play'); |
2982 | requests.shift().respond(200, null, | 2985 | requests.shift().respond(200, null, |
2983 | '#EXTM3U\n' + | 2986 | '#EXTM3U\n' + |
2984 | '#EXT-X-MEDIA-SEQUENCE:5\n' + | 2987 | '#EXT-X-MEDIA-SEQUENCE:5\n' + |
... | @@ -2988,7 +2991,7 @@ test('treats invalid keys as a key request failure', function() { | ... | @@ -2988,7 +2991,7 @@ test('treats invalid keys as a key request failure', function() { |
2988 | '#EXT-X-KEY:METHOD=NONE\n' + | 2991 | '#EXT-X-KEY:METHOD=NONE\n' + |
2989 | '#EXTINF:15.0,\n' + | 2992 | '#EXTINF:15.0,\n' + |
2990 | 'http://media.example.com/fileSequence52-B.ts\n'); | 2993 | 'http://media.example.com/fileSequence52-B.ts\n'); |
2991 | player.tech.hls.sourceBuffer.appendBuffer = function(chunk) { | 2994 | player.tech_.hls.sourceBuffer.appendBuffer = function(chunk) { |
2992 | bytes.push(chunk); | 2995 | bytes.push(chunk); |
2993 | }; | 2996 | }; |
2994 | // segment request | 2997 | // segment request |
... | @@ -3004,7 +3007,7 @@ test('treats invalid keys as a key request failure', function() { | ... | @@ -3004,7 +3007,7 @@ test('treats invalid keys as a key request failure', function() { |
3004 | requests.shift().respond(200, null, ''); | 3007 | requests.shift().respond(200, null, ''); |
3005 | 3008 | ||
3006 | // the first segment should be dropped and playback moves on | 3009 | // the first segment should be dropped and playback moves on |
3007 | player.tech.hls.checkBuffer_(); | 3010 | player.tech_.hls.checkBuffer_(); |
3008 | equal(bytes.length, 0, 'did not append bytes'); | 3011 | equal(bytes.length, 0, 'did not append bytes'); |
3009 | 3012 | ||
3010 | // second segment request | 3013 | // second segment request |
... | @@ -3021,7 +3024,7 @@ test('live stream should not call endOfStream', function(){ | ... | @@ -3021,7 +3024,7 @@ test('live stream should not call endOfStream', function(){ |
3021 | type: 'application/vnd.apple.mpegurl' | 3024 | type: 'application/vnd.apple.mpegurl' |
3022 | }); | 3025 | }); |
3023 | openMediaSource(player); | 3026 | openMediaSource(player); |
3024 | player.tech.trigger('play'); | 3027 | player.tech_.trigger('play'); |
3025 | requests[0].respond(200, null, | 3028 | requests[0].respond(200, null, |
3026 | '#EXTM3U\n' + | 3029 | '#EXTM3U\n' + |
3027 | '#EXT-X-MEDIA-SEQUENCE:0\n' + | 3030 | '#EXT-X-MEDIA-SEQUENCE:0\n' + |
... | @@ -3030,7 +3033,7 @@ test('live stream should not call endOfStream', function(){ | ... | @@ -3030,7 +3033,7 @@ test('live stream should not call endOfStream', function(){ |
3030 | ); | 3033 | ); |
3031 | requests[1].response = window.bcSegment; | 3034 | requests[1].response = window.bcSegment; |
3032 | requests[1].respond(200, null, ""); | 3035 | requests[1].respond(200, null, ""); |
3033 | equal("open", player.tech.hls.mediaSource.readyState, | 3036 | equal("open", player.tech_.hls.mediaSource.readyState, |
3034 | "media source should be in open state, not ended state for live stream after the last segment in m3u8 downloaded"); | 3037 | "media source should be in open state, not ended state for live stream after the last segment in m3u8 downloaded"); |
3035 | }); | 3038 | }); |
3036 | 3039 | ||
... | @@ -3044,7 +3047,7 @@ test('does not download segments if preload option set to none', function() { | ... | @@ -3044,7 +3047,7 @@ test('does not download segments if preload option set to none', function() { |
3044 | openMediaSource(player); | 3047 | openMediaSource(player); |
3045 | standardXHRResponse(requests.shift()); // master | 3048 | standardXHRResponse(requests.shift()); // master |
3046 | standardXHRResponse(requests.shift()); // media | 3049 | standardXHRResponse(requests.shift()); // media |
3047 | player.tech.hls.checkBuffer_(); | 3050 | player.tech_.hls.checkBuffer_(); |
3048 | 3051 | ||
3049 | requests = requests.filter(function(request) { | 3052 | requests = requests.filter(function(request) { |
3050 | return !/m3u8$/.test(request.uri); | 3053 | return !/m3u8$/.test(request.uri); | ... | ... |
-
Please register or sign in to post a comment