feat: release v0.0.1
This commit is contained in:
24
dist/core/engine-selector.js
vendored
Normal file
24
dist/core/engine-selector.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
Reference in New Issue
Block a user