Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match vimeo direct urls #1818

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/media/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the period needed to be escaped, but apparently not.

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 @@ -151,6 +151,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