Merge pull request #138 from videojs/hotfix/typed-array-detection
Require typed arrays for the tech to be supported
Showing
2 changed files
with
16 additions
and
1 deletions
... | @@ -513,9 +513,15 @@ videojs.Hls.supportsNativeHls = (function() { | ... | @@ -513,9 +513,15 @@ videojs.Hls.supportsNativeHls = (function() { |
513 | })(); | 513 | })(); |
514 | 514 | ||
515 | videojs.Hls.isSupported = function() { | 515 | videojs.Hls.isSupported = function() { |
516 | |||
517 | // Only use the HLS tech if native HLS isn't available | ||
516 | return !videojs.Hls.supportsNativeHls && | 518 | return !videojs.Hls.supportsNativeHls && |
519 | // Flash must be supported for the fallback to work | ||
517 | videojs.Flash.isSupported() && | 520 | videojs.Flash.isSupported() && |
518 | videojs.MediaSource; | 521 | // Media sources must be available to stream bytes to Flash |
522 | videojs.MediaSource && | ||
523 | // Typed arrays are used to repackage the segments | ||
524 | window.Uint8Array; | ||
519 | }; | 525 | }; |
520 | 526 | ||
521 | videojs.Hls.canPlaySource = function(srcObj) { | 527 | videojs.Hls.canPlaySource = function(srcObj) { | ... | ... |
... | @@ -1152,6 +1152,15 @@ test('has no effect if native HLS is available', function() { | ... | @@ -1152,6 +1152,15 @@ test('has no effect if native HLS is available', function() { |
1152 | player.dispose(); | 1152 | player.dispose(); |
1153 | }); | 1153 | }); |
1154 | 1154 | ||
1155 | test('is not supported on browsers without typed arrays', function() { | ||
1156 | var oldArray = window.Uint8Array; | ||
1157 | window.Uint8Array = null; | ||
1158 | ok(!videojs.Hls.isSupported(), 'HLS is not supported'); | ||
1159 | |||
1160 | // cleanup | ||
1161 | window.Uint8Array = oldArray; | ||
1162 | }); | ||
1163 | |||
1155 | test('tracks the bytes downloaded', function() { | 1164 | test('tracks the bytes downloaded', function() { |
1156 | player.src({ | 1165 | player.src({ |
1157 | src: 'http://example.com/media.m3u8', | 1166 | src: 'http://example.com/media.m3u8', | ... | ... |
-
Please register or sign in to post a comment