Do not throw is HLS is included in the techOrder
HLS has been converted to a source handler but if people are still using the old tech-based mechanism, don't break their player completely. Log a deprecation warning for now and we can remove it completely later.
Showing
2 changed files
with
21 additions
and
10 deletions
... | @@ -73,6 +73,13 @@ videojs.Hls = videojs.extends(Component, { | ... | @@ -73,6 +73,13 @@ videojs.Hls = videojs.extends(Component, { |
73 | } | 73 | } |
74 | }); | 74 | }); |
75 | 75 | ||
76 | // HLS is a source handler, not a tech. Make sure attempts to use it | ||
77 | // as one do not cause exceptions. | ||
78 | videojs.Hls.canPlaySource = function() { | ||
79 | return videojs.log.warn('HLS is no longer a tech. Please remove it from ' + | ||
80 | 'your player\'s techOrder.'); | ||
81 | }; | ||
82 | |||
76 | /** | 83 | /** |
77 | * The Source Handler object, which informs video.js what additional | 84 | * The Source Handler object, which informs video.js what additional |
78 | * MIME types are supported and sets up playback. It is registered | 85 | * MIME types are supported and sets up playback. It is registered |
... | @@ -1098,15 +1105,11 @@ videojs.Hls.supportsNativeHls = (function() { | ... | @@ -1098,15 +1105,11 @@ videojs.Hls.supportsNativeHls = (function() { |
1098 | (/probably|maybe/).test(vndMpeg); | 1105 | (/probably|maybe/).test(vndMpeg); |
1099 | })(); | 1106 | })(); |
1100 | 1107 | ||
1108 | // HLS is a source handler, not a tech. Make sure attempts to use it | ||
1109 | // as one do not cause exceptions. | ||
1101 | videojs.Hls.isSupported = function() { | 1110 | videojs.Hls.isSupported = function() { |
1102 | // Only use the HLS tech if native HLS isn't available | 1111 | return videojs.log.warn('HLS is no longer a tech. Please remove it from ' + |
1103 | return !videojs.Hls.supportsNativeHls && | 1112 | 'your player\'s techOrder.'); |
1104 | // Flash must be supported for the fallback to work | ||
1105 | videojs.getComponent('Flash').isSupported() && | ||
1106 | // Media sources must be available to stream bytes to Flash | ||
1107 | videojs.MediaSource && | ||
1108 | // Typed arrays are used to repackage the segments | ||
1109 | window.Uint8Array; | ||
1110 | }; | 1113 | }; |
1111 | 1114 | ||
1112 | /** | 1115 | /** | ... | ... |
... | @@ -73,12 +73,12 @@ var | ... | @@ -73,12 +73,12 @@ var |
73 | }; | 73 | }; |
74 | }, | 74 | }, |
75 | 75 | ||
76 | createPlayer = function() { | 76 | createPlayer = function(options) { |
77 | var video, player; | 77 | var video, player; |
78 | video = document.createElement('video'); | 78 | video = document.createElement('video'); |
79 | video.className = 'video-js'; | 79 | video.className = 'video-js'; |
80 | document.querySelector('#qunit-fixture').appendChild(video); | 80 | document.querySelector('#qunit-fixture').appendChild(video); |
81 | player = videojs(video, { | 81 | player = videojs(video, options || { |
82 | flash: { | 82 | flash: { |
83 | swf: '' | 83 | swf: '' |
84 | } | 84 | } |
... | @@ -381,6 +381,14 @@ test('duration is set when the source opens after the playlist is loaded', funct | ... | @@ -381,6 +381,14 @@ test('duration is set when the source opens after the playlist is loaded', funct |
381 | equal(player.tech.hls.mediaSource.duration , 40, 'set the duration'); | 381 | equal(player.tech.hls.mediaSource.duration , 40, 'set the duration'); |
382 | }); | 382 | }); |
383 | 383 | ||
384 | test('including HLS as a tech does not error', function() { | ||
385 | var player = createPlayer({ | ||
386 | techOrder: ['hls', 'html5'] | ||
387 | }); | ||
388 | |||
389 | ok(player, 'created the player'); | ||
390 | }); | ||
391 | |||
384 | test('creates a PlaylistLoader on init', function() { | 392 | test('creates a PlaylistLoader on init', function() { |
385 | player.src({ | 393 | player.src({ |
386 | src: 'manifest/playlist.m3u8', | 394 | src: 'manifest/playlist.m3u8', | ... | ... |
-
Please register or sign in to post a comment