7b07f4a0 by David LaPalomento

Merge pull request #138 from videojs/hotfix/typed-array-detection

Require typed arrays for the tech to be supported
2 parents f2204738 7cb1aa2c
......@@ -513,9 +513,15 @@ videojs.Hls.supportsNativeHls = (function() {
})();
videojs.Hls.isSupported = function() {
// Only use the HLS tech if native HLS isn't available
return !videojs.Hls.supportsNativeHls &&
// Flash must be supported for the fallback to work
videojs.Flash.isSupported() &&
videojs.MediaSource;
// Media sources must be available to stream bytes to Flash
videojs.MediaSource &&
// Typed arrays are used to repackage the segments
window.Uint8Array;
};
videojs.Hls.canPlaySource = function(srcObj) {
......
......@@ -1152,6 +1152,15 @@ test('has no effect if native HLS is available', function() {
player.dispose();
});
test('is not supported on browsers without typed arrays', function() {
var oldArray = window.Uint8Array;
window.Uint8Array = null;
ok(!videojs.Hls.isSupported(), 'HLS is not supported');
// cleanup
window.Uint8Array = oldArray;
});
test('tracks the bytes downloaded', function() {
player.src({
src: 'http://example.com/media.m3u8',
......