Skip to content

Commit

Permalink
@H1D fixed an issue with file extension type detection. closes #1818
Browse files Browse the repository at this point in the history
  • Loading branch information
H1D authored and heff committed Jan 22, 2015
1 parent 4bde5c8 commit c8781cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CHANGELOG
* @heff fixed type support checking for an empty src string ([view](https://github.com/videojs/video.js/pull/1797))
* @carpasse fixed a bug in updating child indexes after removing components ([view](https://github.com/videojs/video.js/pull/1814))
* @dmlap fixed a bug where native controls would show after switching techs ([view](https://github.com/videojs/video.js/pull/1811))
* @H1D fixed an issue with file extension type detection ([view](https://github.com/videojs/video.js/pull/1818))

--------------------

Expand Down
2 changes: 1 addition & 1 deletion src/js/media/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ vjs.Html5.nativeSourceHandler.canHandleSource = function(source){
return canPlayType(source.type);
} else if (source.src) {
// If no type, fall back to checking 'video/[EXTENSION]'
match = source.src.match(/\.([^\/\?]+)(\?[^\/]+)?$/i);
match = source.src.match(/\.([^.\/\?]+)(\?[^\/]+)?$/i);
ext = match && match[1];

return canPlayType('video/'+ext);
Expand Down
3 changes: 3 additions & 0 deletions test/unit/media.html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ test('native source handler canHandleSource', function(){

equal(canHandleSource({ type: 'video/mp4', src: 'video.flv' }), 'maybe', 'Native source handler reported type support');
equal(canHandleSource({ src: 'http://www.example.com/video.mp4' }), 'maybe', 'Native source handler reported extension support');
equal(canHandleSource({ src: 'https://example.com/video.sd.mp4?s=foo&token=bar' }), 'maybe', 'Native source handler reported extension support');
equal(canHandleSource({ src: 'https://example.com/video.sd.mp4?s=foo' }), 'maybe', 'Native source handler reported extension support');

// Test for issue videojs/video.js#1785 and other potential failures
equal(canHandleSource({ src: '' }), '', 'Native source handler handled empty src');
equal(canHandleSource({}), '', 'Native source handler handled empty object');
Expand Down

0 comments on commit c8781cf

Please sign in to comment.