mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
9 lines
421 B
TypeScript
9 lines
421 B
TypeScript
import { parseMuxVideoURL } from '@videojs/media/dom/mux';
|
|
import { SOURCES, type SourceId } from './sources';
|
|
|
|
export function getMuxAssetId(source: SourceId): string | undefined {
|
|
const { url } = SOURCES[source];
|
|
// MP4 renditions (`https://stream.mux.com/<playback-id>/<rendition>.mp4`) aren't stream URLs.
|
|
return parseMuxVideoURL(url)?.playbackId ?? url.match(/stream\.mux\.com\/([\w-]+)\/[\w-]+\.mp4/)?.[1];
|
|
}
|