mediabunny
Version:
Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.
18 lines (17 loc) • 678 B
JavaScript
/*!
* Copyright (c) 2026-present, Vanilagy and contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
export const TIMESCALE = 90_000; // MPEG-TS timestamps run on a 90 kHz clock
export const TS_PACKET_SIZE = 188;
export const buildMpegTsMimeType = (codecStrings) => {
let string = 'video/MP2T';
const uniqueCodecStrings = [...new Set(codecStrings.filter(Boolean))];
if (uniqueCodecStrings.length > 0) {
string += `; codecs="${uniqueCodecStrings.join(', ')}"`;
}
return string;
};