/* Will display an overview with the following datasources: 1. Current broadcaster. 2. Viewer count. 3. Video settings. TODO: Link each overview value to the sub-page that focuses on it. */ import React, { useState, useEffect, useContext } from "react"; <<<<<<< HEAD import { Row, Skeleton, Typography } from "antd"; ======= import { Row, Col, Skeleton, Result, List, Typography, Card } from "antd"; >>>>>>> 4cdf5b73baa0584a0e6b2f586c27ca53923c65c7 import { UserOutlined, ClockCircleOutlined } from "@ant-design/icons"; import { formatDistanceToNow, formatRelative } from "date-fns"; import { ServerStatusContext } from "../utils/server-status-context"; import StatisticItem from "./components/statistic" import LogTable from "./components/log-table"; import Offline from './offline-notice'; import { STATUS, SERVER_CONFIG, LOGS_WARN, fetchData, FETCH_INTERVAL, } from "../utils/apis"; import { formatIPAddress, isEmptyObject } from "../utils/format"; const { Title } = Typography; <<<<<<< HEAD ======= >>>>>>> 4cdf5b73baa0584a0e6b2f586c27ca53923c65c7 <<<<<<< HEAD export default function Home() { const context = useContext(BroadcastStatusContext); ======= export default function Stats() { const context = useContext(ServerStatusContext); >>>>>>> ca90d28ec1d0a0f0059a4649dd00fb95b9d4fa3d const { broadcaster } = context || {}; const { remoteAddr, streamDetails } = broadcaster || {}; // Pull in the server status so we can show server overview. const [stats, setStats] = useState(null); const getStats = async () => { try { const result = await fetchData(STATUS); setStats(result); } catch (error) { console.log(error); } getConfig(); getLogs(); }; // Pull in the server config so we can show config overview. const [config, setConfig] = useState({ streamKey: "", yp: { enabled: false, }, videoSettings: { videoQualityVariants: [ { audioPassthrough: false, videoBitrate: 0, audioBitrate: 0, framerate: 0, }, ], }, }); const [logs, setLogs] = useState([]); const getConfig = async () => { try { const result = await fetchData(SERVER_CONFIG); setConfig(result); } catch (error) { console.log(error); } }; const getLogs = async () => { try { const result = await fetchData(LOGS_WARN); setLogs(result); } catch (error) { console.log("==== error", error); } }; useEffect(() => { setInterval(getStats, FETCH_INTERVAL); getStats(); }, []); if (isEmptyObject(config) || isEmptyObject(stats)) { return (
./test/ocTestStream.sh yourVideo.mp4