Files
_hublib-web/dist/core/engine-selector.js
2026-02-27 09:50:13 +03:00

24 lines
744 B
JavaScript

const HLS_MIME_TYPES = new Set([
"application/x-mpegurl",
"application/vnd.apple.mpegurl",
]);
export const isHlsSource = ({ src, type }) => {
const sourceType = (type || "").toLowerCase();
return HLS_MIME_TYPES.has(sourceType) || /\.m3u8($|\?)/i.test(src || "");
};
export const selectPlaybackEngine = ({ src, type, strategy = "auto", hlsSupported = false, isIOS = false, }) => {
if (strategy === "force-hls") {
return "hls";
}
if (strategy === "force-videojs") {
return "videojs";
}
if (!isHlsSource({ src, type })) {
return "videojs";
}
if (isIOS) {
return "videojs";
}
return hlsSupported ? "hls" : "videojs";
};
//# sourceMappingURL=engine-selector.js.map