2e71aa18 by David LaPalomento

Require typed arrays for the tech to be supported

Typed arrays are used extensively in repackaging segments. Make sure the tech doesn't load on platforms they're not available on (e.g. IE8). Fixes #137.
1 parent f2204738
......@@ -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;
delete window.Uint8Array;
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',
......