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 by lowercase extensions in "_canPlay" #1091
Conversation
@@ -408,6 +408,8 @@ export default class HTML5Video extends Playback { | |||
|
|||
HTML5Video._canPlay = function(type, mimeTypesByExtension, resourceUrl, mimeType) { | |||
var extension = (resourceUrl.split('?')[0].match(/.*\.(.*)$/) || [])[1] | |||
extension = (extension || "").toLowerCase() | |||
|
|||
var mimeTypes = mimeType || mimeTypesByExtension[extension] || [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sjlu
Well spotted thanks for the PR.
I think changing this line to
var mimeTypes = mimeType || (extension && mimeTypesByExtension[extension.toLowerCase()]) || []
would be better, because we shouldn't be trying to access mimeTypesByExtension[undefined]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will change.
@tjenkinson change made |
Thanks @sjlu! 🍻 |
Glad to be of help @towerz |
In case the URL contains a uppercase character, it'll help match the mediaType list (e.g. "MP4" vs "mp4)