c93a4788 by David LaPalomento

Merge pull request #85 from videojs/hotfix/canPlaySource

Only support HLS MIME types. Fixes #82.
2 parents d7c2b800 c39a821a
...@@ -529,7 +529,7 @@ videojs.Hls.isSupported = function() { ...@@ -529,7 +529,7 @@ videojs.Hls.isSupported = function() {
529 }; 529 };
530 530
531 videojs.Hls.canPlaySource = function(srcObj) { 531 videojs.Hls.canPlaySource = function(srcObj) {
532 return mpegurlRE.test(srcObj.type) || videojs.Flash.canPlaySource.call(this, srcObj); 532 return mpegurlRE.test(srcObj.type);
533 }; 533 };
534 534
535 /** 535 /**
......
...@@ -1066,4 +1066,20 @@ test('disposes the playlist loader', function() { ...@@ -1066,4 +1066,20 @@ test('disposes the playlist loader', function() {
1066 strictEqual(disposes, 1, 'disposed playlist loader'); 1066 strictEqual(disposes, 1, 'disposed playlist loader');
1067 }); 1067 });
1068 1068
1069 test('only supports HLS MIME types', function() {
1070 ok(videojs.Hls.canPlaySource({
1071 type: 'aPplicatiOn/x-MPegUrl'
1072 }), 'supports x-mpegurl');
1073 ok(videojs.Hls.canPlaySource({
1074 type: 'aPplicatiOn/VnD.aPPle.MpEgUrL'
1075 }), 'supports vnd.apple.mpegurl');
1076
1077 ok(!videojs.Hls.canPlaySource({
1078 type: 'video/mp4'
1079 }), 'does not support mp4');
1080 ok(!videojs.Hls.canPlaySource({
1081 type: 'video/x-flv'
1082 }), 'does not support flv');
1083 });
1084
1069 })(window, window.videojs); 1085 })(window, window.videojs);
......