mirror of
https://github.com/videojs/video.js.git
synced 2025-02-08 12:05:47 +02:00
Close GH-805: Flash - ignore codec info - added tests for #785.
This commit is contained in:
parent
6e3eb5075e
commit
4c6a12898b
@ -331,7 +331,16 @@ vjs.Flash.isSupported = function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
vjs.Flash.canPlaySource = function(srcObj){
|
vjs.Flash.canPlaySource = function(srcObj){
|
||||||
if (srcObj.type in vjs.Flash.formats || srcObj.type in vjs.Flash.streamingFormats) { return 'maybe'; }
|
var type;
|
||||||
|
|
||||||
|
if (!srcObj.type) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
type = srcObj.type.replace(/;.*/,'').toLowerCase();
|
||||||
|
if (type in vjs.Flash.formats || type in vjs.Flash.streamingFormats) {
|
||||||
|
return 'maybe';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
vjs.Flash.formats = {
|
vjs.Flash.formats = {
|
||||||
|
@ -45,4 +45,20 @@ test('test isStreamingSrc', function() {
|
|||||||
ok(!isStreamingSrc('http://streaming.is/fun'));
|
ok(!isStreamingSrc('http://streaming.is/fun'));
|
||||||
ok(!isStreamingSrc('https://streaming.is/fun'));
|
ok(!isStreamingSrc('https://streaming.is/fun'));
|
||||||
ok(!isStreamingSrc('file://streaming.is/fun'));
|
ok(!isStreamingSrc('file://streaming.is/fun'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test canPlaySource', function() {
|
||||||
|
var canPlaySource = vjs.Flash.canPlaySource;
|
||||||
|
|
||||||
|
// supported
|
||||||
|
ok(canPlaySource({ type: 'video/mp4; codecs=avc1.42E01E,mp4a.40.2' }), 'codecs supported');
|
||||||
|
ok(canPlaySource({ type: 'video/mp4' }), 'video/mp4 supported');
|
||||||
|
ok(canPlaySource({ type: 'video/x-flv' }), 'video/x-flv supported');
|
||||||
|
ok(canPlaySource({ type: 'video/flv' }), 'video/flv supported');
|
||||||
|
ok(canPlaySource({ type: 'video/m4v' }), 'video/m4v supported');
|
||||||
|
ok(canPlaySource({ type: 'VIDEO/FLV' }), 'capitalized mime type');
|
||||||
|
|
||||||
|
// not supported
|
||||||
|
ok(!canPlaySource({ type: 'video/webm; codecs="vp8, vorbis"' }));
|
||||||
|
ok(!canPlaySource({ type: 'video/webm' }));
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user