This commit is contained in:
hakimel
2021-11-24 11:07:11 +01:00
parent ec32d44085
commit c5d549810e
4 changed files with 25 additions and 5 deletions

View File

@ -279,4 +279,19 @@ export const getRemainingHeight = ( element, height = 0 ) => {
return height;
}
const fileExtensionToMimeMap = {
'mp4': 'video/mp4',
'm4a': 'video/mp4',
'ogv': 'video/ogg',
'mpeg': 'video/mpeg',
'webm': 'video/webm'
}
/**
* Guess the MIME type for common file formats.
*/
export const getMimeTypeFromFile = ( filename='' ) => {
return fileExtensionToMimeMap[filename.split('.').pop()]
}