2021-03-10 19:34:21 +01:00
|
|
|
// @flow
|
2022-01-14 21:24:16 +01:00
|
|
|
import { lazyImport } from 'util/lazyImport';
|
2021-07-27 22:35:22 +02:00
|
|
|
import { LIVESTREAM_EMBED_URL } from 'constants/livestream';
|
2021-04-23 21:59:48 +02:00
|
|
|
import { useIsMobile } from 'effects/use-screensize';
|
2021-12-16 22:59:13 +01:00
|
|
|
import classnames from 'classnames';
|
2022-01-14 21:24:16 +01:00
|
|
|
import FileTitleSection from 'component/fileTitleSection';
|
2021-12-16 22:59:13 +01:00
|
|
|
import LivestreamLink from 'component/livestreamLink';
|
2022-01-14 21:24:16 +01:00
|
|
|
import LivestreamScheduledInfo from 'component/livestreamScheduledInfo';
|
|
|
|
import React from 'react';
|
2021-10-18 17:54:59 +02:00
|
|
|
|
2022-01-14 21:24:16 +01:00
|
|
|
const LivestreamChatLayout = lazyImport(() => import('component/livestreamChatLayout' /* webpackChunkName: "chat" */));
|
2021-03-10 19:34:21 +01:00
|
|
|
|
|
|
|
type Props = {
|
2022-01-14 21:24:16 +01:00
|
|
|
activeStreamUri: boolean | string,
|
2021-03-10 19:34:21 +01:00
|
|
|
claim: ?StreamClaim,
|
2021-12-16 22:59:13 +01:00
|
|
|
hideComments: boolean,
|
2022-01-14 21:24:16 +01:00
|
|
|
isCurrentClaimLive: boolean,
|
2021-12-16 22:59:13 +01:00
|
|
|
release: any,
|
|
|
|
showLivestream: boolean,
|
|
|
|
showScheduledInfo: boolean,
|
2022-01-14 21:24:16 +01:00
|
|
|
uri: string,
|
2021-03-10 19:34:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function LivestreamLayout(props: Props) {
|
2021-12-16 22:59:13 +01:00
|
|
|
const {
|
2022-01-14 21:24:16 +01:00
|
|
|
activeStreamUri,
|
2021-12-16 22:59:13 +01:00
|
|
|
claim,
|
|
|
|
hideComments,
|
2022-01-14 21:24:16 +01:00
|
|
|
isCurrentClaimLive,
|
2021-12-16 22:59:13 +01:00
|
|
|
release,
|
|
|
|
showLivestream,
|
|
|
|
showScheduledInfo,
|
2022-01-14 21:24:16 +01:00
|
|
|
uri,
|
2021-12-16 22:59:13 +01:00
|
|
|
} = props;
|
|
|
|
|
2021-04-23 21:59:48 +02:00
|
|
|
const isMobile = useIsMobile();
|
2021-03-10 19:34:21 +01:00
|
|
|
|
2022-01-14 21:24:16 +01:00
|
|
|
if (!claim || !claim.signing_channel) return null;
|
2021-03-10 19:34:21 +01:00
|
|
|
|
2022-01-14 21:24:16 +01:00
|
|
|
const { name: channelName, claim_id: channelClaimId } = claim.signing_channel;
|
2021-03-18 18:21:49 +01:00
|
|
|
|
2021-03-10 19:34:21 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className="section card-stack">
|
2021-12-16 22:59:13 +01:00
|
|
|
<div
|
|
|
|
className={classnames('file-render file-render--video livestream', {
|
|
|
|
'file-render--scheduledLivestream': !showLivestream,
|
|
|
|
})}
|
|
|
|
>
|
2021-03-10 19:34:21 +01:00
|
|
|
<div className="file-viewer">
|
2021-12-16 22:59:13 +01:00
|
|
|
{showLivestream && (
|
|
|
|
<iframe
|
|
|
|
src={`${LIVESTREAM_EMBED_URL}/${channelClaimId}?skin=odysee&autoplay=1`}
|
|
|
|
scrolling="no"
|
|
|
|
allowFullScreen
|
|
|
|
/>
|
|
|
|
)}
|
2022-01-14 21:24:16 +01:00
|
|
|
|
2021-12-16 22:59:13 +01:00
|
|
|
{showScheduledInfo && <LivestreamScheduledInfo release={release} />}
|
2021-03-10 19:34:21 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-12-16 22:59:13 +01:00
|
|
|
{hideComments && !showScheduledInfo && (
|
2021-06-03 17:55:16 +02:00
|
|
|
<div className="help--notice">
|
2021-07-26 16:27:39 +02:00
|
|
|
{channelName
|
2021-09-15 04:08:41 +02:00
|
|
|
? __('%channel% has disabled chat for this stream. Enjoy the stream!', { channel: channelName })
|
2021-07-26 16:27:39 +02:00
|
|
|
: __('This channel has disabled chat for this stream. Enjoy the stream!')}
|
2021-06-03 17:55:16 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2021-12-16 22:59:13 +01:00
|
|
|
{!activeStreamUri && !showScheduledInfo && !isCurrentClaimLive && (
|
2021-03-18 18:21:49 +01:00
|
|
|
<div className="help--notice">
|
2021-07-26 16:27:39 +02:00
|
|
|
{channelName
|
|
|
|
? __("%channelName% isn't live right now, but the chat is! Check back later to watch the stream.", {
|
|
|
|
channelName,
|
|
|
|
})
|
|
|
|
: __("This channel isn't live right now, but the chat is! Check back later to watch the stream.")}
|
2021-03-18 18:21:49 +01:00
|
|
|
</div>
|
|
|
|
)}
|
2021-04-23 21:59:48 +02:00
|
|
|
|
2021-12-22 17:12:44 +01:00
|
|
|
{activeStreamUri && (
|
|
|
|
<LivestreamLink
|
|
|
|
title={__("Click here to access the stream that's currently active")}
|
|
|
|
claimUri={activeStreamUri}
|
|
|
|
/>
|
|
|
|
)}
|
2021-12-16 22:59:13 +01:00
|
|
|
|
2022-01-14 21:24:16 +01:00
|
|
|
{isMobile && !hideComments && (
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
<LivestreamChatLayout uri={uri} />
|
|
|
|
</React.Suspense>
|
|
|
|
)}
|
2021-04-23 21:59:48 +02:00
|
|
|
|
2021-12-16 22:59:13 +01:00
|
|
|
<FileTitleSection uri={uri} livestream isLive={showLivestream} />
|
2021-03-10 19:34:21 +01:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|