qhkr2z22o: Prefer hls.js and fall back to the thumbnail when video cannot play
This commit is contained in:
@@ -9,11 +9,15 @@ export interface PlaybackEnv {
|
||||
hlsJsSupported: boolean;
|
||||
}
|
||||
|
||||
/** No hlsUrl: thumbnail only. Native HLS wins; hls.js is the fallback. */
|
||||
/**
|
||||
* No hlsUrl: thumbnail only. hls.js (Media Source Extensions) is preferred
|
||||
* because Chromium reports partial native HLS support it cannot honour; native
|
||||
* HLS is only chosen where hls.js is unsupported (Safari on iOS).
|
||||
*/
|
||||
export function choosePlayback(hlsUrl: string | null | undefined, env: PlaybackEnv): Playback {
|
||||
if (!hlsUrl) return "none";
|
||||
if (env.nativeHls) return "native";
|
||||
return env.hlsJsSupported ? "hlsjs" : "none";
|
||||
if (env.hlsJsSupported) return "hlsjs";
|
||||
return env.nativeHls ? "native" : "none";
|
||||
}
|
||||
|
||||
export function supportsNativeHls(video: Pick<HTMLVideoElement, "canPlayType">): boolean {
|
||||
|
||||
Reference in New Issue
Block a user