From 39202efcf5e10737182cd321f6755af394b86025 Mon Sep 17 00:00:00 2001 From: Dnouv <61188295+Dnouv@users.noreply.github.com> Date: Mon, 4 Apr 2022 21:53:41 +0530 Subject: [PATCH] [IMPROVE] Change minor UI for mainstage (#124) * Restyle mainstage * Add error alert * remove unused code * Update app/components/clientsideonly/videostreamer.js Co-authored-by: Debdut Chakraborty --- .../clientsideonly/videostreamer.js | 75 +++++++++++++++---- app/pages/virtualconf/mainstage/[id].js | 16 ++-- app/styles/Videostreamer.module.css | 8 +- 3 files changed, 69 insertions(+), 30 deletions(-) diff --git a/app/components/clientsideonly/videostreamer.js b/app/components/clientsideonly/videostreamer.js index 53dc7d2e..540a45d9 100644 --- a/app/components/clientsideonly/videostreamer.js +++ b/app/components/clientsideonly/videostreamer.js @@ -1,39 +1,82 @@ -import { Col } from 'react-bootstrap'; -import styles from '../../styles/Videostreamer.module.css'; -import Script from 'next/script'; -import Head from 'next/head'; +import { Col, Toast, ToastContainer } from "react-bootstrap"; +import styles from "../../styles/Videostreamer.module.css"; +import Script from "next/script"; +import Head from "next/head"; +import { useEffect, useState } from "react"; export default function Videostreamer(props) { + const [ping, setPing] = useState(false) + const pingStream = async () => { + const response = await fetch(props.src) + if (response.ok) { + setPing(true) + } + return; + } + useEffect(() => { + setInterval(() => { + pingStream().catch(e => { + console.error("Stream error", e) + setPing(false) + }) + }, 60000) + + }, []) + + const handleToast = () => { + setPing(true) + } return ( <>