mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-10 13:15:25 +03:00
also check for media decode error to fallback to HLS
This commit is contained in:
parent
5870cde614
commit
d8129cceb5
@ -21,6 +21,10 @@ import { MdForward10, MdReplay10 } from "react-icons/md";
|
|||||||
import useKeyboardListener from "@/hooks/use-keyboard-listener";
|
import useKeyboardListener from "@/hooks/use-keyboard-listener";
|
||||||
|
|
||||||
const HLS_MIME_TYPE = "application/vnd.apple.mpegurl" as const;
|
const HLS_MIME_TYPE = "application/vnd.apple.mpegurl" as const;
|
||||||
|
const unsupportedErrorCodes = [
|
||||||
|
MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
|
||||||
|
MediaError.MEDIA_ERR_DECODE,
|
||||||
|
];
|
||||||
|
|
||||||
type HlsVideoPlayerProps = {
|
type HlsVideoPlayerProps = {
|
||||||
className: string;
|
className: string;
|
||||||
@ -188,7 +192,7 @@ export default function HlsVideoPlayer({
|
|||||||
if (
|
if (
|
||||||
!hlsRef.current &&
|
!hlsRef.current &&
|
||||||
// @ts-expect-error code does exist
|
// @ts-expect-error code does exist
|
||||||
e.target.error.code == MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED &&
|
unsupportedErrorCodes.includes(e.target.error.code) &&
|
||||||
videoRef.current
|
videoRef.current
|
||||||
) {
|
) {
|
||||||
setUseHlsCompat(true);
|
setUseHlsCompat(true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user