vidstack
Version:
Build awesome media experiences on the web.
25 lines (22 loc) • 900 B
JavaScript
import { isString } from 'maverick.js/std';
import { H as HLS_VIDEO_EXTENSIONS, a as HLS_VIDEO_TYPES } from '../audio/loader.js';
import { W as isHLSSupported, p as preconnect } from '../../media-core.js';
import { V as VideoProviderLoader } from '../video/loader.js';
class HLSProviderLoader extends VideoProviderLoader {
static supported = isHLSSupported();
preconnect() {
preconnect("https://cdn.jsdelivr.net", "preconnect");
}
canPlay({ src, type }) {
return HLSProviderLoader.supported && isString(src) && (HLS_VIDEO_EXTENSIONS.test(src) || HLS_VIDEO_TYPES.has(type));
}
async load(context) {
if (!this._video) {
throw Error(
"[vidstack] `<video>` element was not found - did you forget to include `<media-outlet>`?"
);
}
return new (await import('./provider.js')).HLSProvider(this._video, context);
}
}
export { HLSProviderLoader as H };