@tianfeng98/hls.js
Version:
HLS.js is a JavaScript library that supports playing MPEG-TS and HEVC encoded HLS streams in browsers with support for MSE.
18 lines (16 loc) • 443 B
text/typescript
/**
* MediaSource helper
*/
export function getMediaSource(
preferManagedMediaSource = true,
): typeof MediaSource | undefined {
if (typeof self === 'undefined') return undefined;
const mms =
(preferManagedMediaSource || !self.MediaSource) &&
((self as any).ManagedMediaSource as undefined | typeof MediaSource);
return (
mms ||
self.MediaSource ||
((self as any).WebKitMediaSource as typeof MediaSource)
);
}