mirror of
https://github.com/videojs/video.js.git
synced 2025-01-27 11:22:06 +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
|
* src Object with known type
|
||||||
*/
|
*/
|
||||||
function fixSource(src) {
|
function fixSource(src) {
|
||||||
const mimetype = getMimetype(src.src);
|
if (!src.type) {
|
||||||
|
const mimetype = getMimetype(src.src);
|
||||||
|
|
||||||
if (!src.type && mimetype) {
|
if (mimetype) {
|
||||||
src.type = mimetype;
|
src.type = mimetype;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return src;
|
return src;
|
||||||
|
@ -132,7 +132,7 @@ export const getAbsoluteURL = function(url) {
|
|||||||
*/
|
*/
|
||||||
export const getFileExtension = function(path) {
|
export const getFileExtension = function(path) {
|
||||||
if (typeof path === 'string') {
|
if (typeof path === 'string') {
|
||||||
const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i;
|
const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
|
||||||
const pathParts = splitPathRe.exec(path);
|
const pathParts = splitPathRe.exec(path);
|
||||||
|
|
||||||
if (pathParts) {
|
if (pathParts) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user