mirror of
https://github.com/videojs/video.js.git
synced 2025-01-25 11:13:52 +02:00
perf: save ~10ms on player.src
call (#6141)
Don't use a case-insensitive regex for getting the extname. Don't try to guess the type if we're provided with one.
This commit is contained in:
parent
2e69448f49
commit
2e495dd5f5
@ -56,10 +56,12 @@ const filterSource = function(src) {
|
||||
* src Object with known type
|
||||
*/
|
||||
function fixSource(src) {
|
||||
const mimetype = getMimetype(src.src);
|
||||
if (!src.type) {
|
||||
const mimetype = getMimetype(src.src);
|
||||
|
||||
if (!src.type && mimetype) {
|
||||
src.type = mimetype;
|
||||
if (mimetype) {
|
||||
src.type = mimetype;
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
|
@ -132,7 +132,7 @@ export const getAbsoluteURL = function(url) {
|
||||
*/
|
||||
export const getFileExtension = function(path) {
|
||||
if (typeof path === 'string') {
|
||||
const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i;
|
||||
const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
|
||||
const pathParts = splitPathRe.exec(path);
|
||||
|
||||
if (pathParts) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user