Switch to hls.js on error

This commit is contained in:
Nicolas Mowen 2024-03-13 13:56:14 -06:00
parent 88ae21b34a
commit fea09b51a8

View File

@ -179,6 +179,16 @@ export default function HlsVideoPlayer({
} }
onLoadedData={onPlayerLoaded} onLoadedData={onPlayerLoaded}
onEnded={onClipEnded} onEnded={onClipEnded}
onError={(e) => {
if (
// @ts-expect-error code does exist
e.target.error.code == MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED &&
videoRef.current
) {
hlsRef.current = new Hls();
hlsRef.current.attachMedia(videoRef.current);
}
}}
/> />
<VideoControls <VideoControls
video={videoRef.current} video={videoRef.current}