c3592df3 by David LaPalomento

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.
1 parent c518bc3e
......@@ -73,6 +73,13 @@ videojs.Hls = videojs.extends(Component, {
}
});
// HLS is a source handler, not a tech. Make sure attempts to use it
// as one do not cause exceptions.
videojs.Hls.canPlaySource = function() {
return videojs.log.warn('HLS is no longer a tech. Please remove it from ' +
'your player\'s techOrder.');
};
/**
* The Source Handler object, which informs video.js what additional
* MIME types are supported and sets up playback. It is registered
......@@ -1098,15 +1105,11 @@ videojs.Hls.supportsNativeHls = (function() {
(/probably|maybe/).test(vndMpeg);
})();
// HLS is a source handler, not a tech. Make sure attempts to use it
// as one do not cause exceptions.
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.getComponent('Flash').isSupported() &&
// Media sources must be available to stream bytes to Flash
videojs.MediaSource &&
// Typed arrays are used to repackage the segments
window.Uint8Array;
return videojs.log.warn('HLS is no longer a tech. Please remove it from ' +
'your player\'s techOrder.');
};
/**
......
......@@ -73,12 +73,12 @@ var
};
},
createPlayer = function() {
createPlayer = function(options) {
var video, player;
video = document.createElement('video');
video.className = 'video-js';
document.querySelector('#qunit-fixture').appendChild(video);
player = videojs(video, {
player = videojs(video, options || {
flash: {
swf: ''
}
......@@ -381,6 +381,14 @@ test('duration is set when the source opens after the playlist is loaded', funct
equal(player.tech.hls.mediaSource.duration , 40, 'set the duration');
});
test('including HLS as a tech does not error', function() {
var player = createPlayer({
techOrder: ['hls', 'html5']
});
ok(player, 'created the player');
});
test('creates a PlaylistLoader on init', function() {
player.src({
src: 'manifest/playlist.m3u8',
......