2022-05-26 06:38:40 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { useRecoilValue } from 'recoil';
|
|
|
|
import {
|
2022-05-26 08:52:27 +03:00
|
|
|
clientConfigStateAtom,
|
2022-05-26 06:38:40 +03:00
|
|
|
ClientConfigStore,
|
|
|
|
isOnlineSelector,
|
|
|
|
serverStatusState,
|
|
|
|
} from '../../../components/stores/ClientConfigStore';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { OfflineBanner } from '../../../components/ui/OfflineBanner/OfflineBanner';
|
|
|
|
import { Statusbar } from '../../../components/ui/Statusbar/Statusbar';
|
|
|
|
import { OwncastPlayer } from '../../../components/video/OwncastPlayer/OwncastPlayer';
|
2022-05-26 08:52:27 +03:00
|
|
|
import { ClientConfig } from '../../../interfaces/client-config.model';
|
2022-05-26 06:38:40 +03:00
|
|
|
import { ServerStatus } from '../../../interfaces/server-status.model';
|
2022-05-17 08:55:22 +03:00
|
|
|
|
|
|
|
export default function VideoEmbed() {
|
2022-05-26 06:38:40 +03:00
|
|
|
const status = useRecoilValue<ServerStatus>(serverStatusState);
|
2022-05-26 08:52:27 +03:00
|
|
|
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
|
|
|
|
|
|
|
const { name } = clientConfig;
|
2022-05-26 06:38:40 +03:00
|
|
|
|
|
|
|
// const { extraPageContent, version, socialHandles, name, title, tags } = clientConfig;
|
|
|
|
const { viewerCount, lastConnectTime, lastDisconnectTime } = status;
|
|
|
|
const online = useRecoilValue<boolean>(isOnlineSelector);
|
2022-05-17 08:55:22 +03:00
|
|
|
return (
|
2022-05-26 06:38:40 +03:00
|
|
|
<>
|
|
|
|
<ClientConfigStore />
|
|
|
|
<div className="video-embed">
|
|
|
|
{online && <OwncastPlayer source="/hls/stream.m3u8" online={online} />}
|
2022-09-11 04:08:51 +03:00
|
|
|
{!online && <OfflineBanner title={name} text="Stream is offline text goes here." />}{' '}
|
2022-05-26 06:38:40 +03:00
|
|
|
<Statusbar
|
|
|
|
online={online}
|
|
|
|
lastConnectTime={lastConnectTime}
|
|
|
|
lastDisconnectTime={lastDisconnectTime}
|
|
|
|
viewerCount={viewerCount}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</>
|
2022-05-17 08:55:22 +03:00
|
|
|
);
|
|
|
|
}
|