From 47cfead1bc59df22c920418e3388e06444ec8e56 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Wed, 20 Jul 2022 14:54:45 -0500 Subject: [PATCH] video player offline message --- src/components/VideoPlayer.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index 49574c2..e6c768b 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -1,6 +1,14 @@ +import { useState } from "react"; import ReactPlayer from "react-player"; function VideoPlayer(props: { url: string }) { + const [errored, setErrored] = useState(false); + if (errored) { + return
+
Offline - Video Not Available
+ +
; + } return
-
; + onError={() => setErrored(true)} + /> + + } export default VideoPlayer; \ No newline at end of file