mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Add getMimeType to Output & other small adjustments
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export const buildMatroskaMimeType = (info: {
|
||||
isWebM: boolean;
|
||||
hasVideo: boolean;
|
||||
hasAudio: boolean;
|
||||
codecStrings: string[];
|
||||
}) => {
|
||||
const base = info.hasVideo
|
||||
? 'video/'
|
||||
: info.hasAudio
|
||||
? 'audio/'
|
||||
: 'application/';
|
||||
|
||||
let string = base + (info.isWebM ? 'webm' : 'x-matroska');
|
||||
|
||||
if (info.codecStrings.length > 0) {
|
||||
const uniqueCodecMimeTypes = [...new Set(info.codecStrings.filter(Boolean))];
|
||||
string += `; codecs="${uniqueCodecMimeTypes.join(', ')}"`;
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
Reference in New Issue
Block a user