2021-03-10 19:34:21 +01:00
|
|
|
// @flow
|
2021-07-27 22:35:22 +02:00
|
|
|
import { LIVESTREAM_EMBED_URL } from 'constants/livestream';
|
2021-03-10 19:34:21 +01:00
|
|
|
import React from 'react';
|
2021-03-14 04:42:21 +01:00
|
|
|
import FileTitleSection from 'component/fileTitleSection';
|
2021-03-10 19:34:21 +01:00
|
|
|
import LivestreamComments from 'component/livestreamComments';
|
2021-04-23 21:59:48 +02:00
|
|
|
import { useIsMobile } from 'effects/use-screensize';
|
2021-03-10 19:34:21 +01:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
claim: ?StreamClaim,
|
2021-03-18 18:21:49 +01:00
|
|
|
isLive: boolean,
|
2021-06-03 17:55:16 +02:00
|
|
|
chatDisabled: boolean,
|
2021-03-10 19:34:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function LivestreamLayout(props: Props) {
|
2021-06-17 20:55:23 +02:00
|
|
|
const { claim, uri, isLive, chatDisabled } = props;
|
2021-04-23 21:59:48 +02:00
|
|
|
const isMobile = useIsMobile();
|
2021-03-10 19:34:21 +01:00
|
|
|
|
2021-03-19 21:14:31 +01:00
|
|
|
if (!claim || !claim.signing_channel) {
|
2021-03-10 19:34:21 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-03-19 21:14:31 +01:00
|
|
|
const channelName = claim.signing_channel.name;
|
|
|
|
const channelClaimId = claim.signing_channel.claim_id;
|
2021-03-18 18:21:49 +01:00
|
|
|
|
2021-03-10 19:34:21 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className="section card-stack">
|
|
|
|
<div className="file-render file-render--video livestream">
|
|
|
|
<div className="file-viewer">
|
2021-03-19 21:14:31 +01:00
|
|
|
<iframe
|
2021-07-27 22:35:22 +02:00
|
|
|
src={`${LIVESTREAM_EMBED_URL}/${channelClaimId}?skin=odysee&autoplay=1`}
|
2021-03-19 21:14:31 +01:00
|
|
|
scrolling="no"
|
|
|
|
allowFullScreen
|
|
|
|
/>
|
2021-03-10 19:34:21 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-06-03 17:55:16 +02:00
|
|
|
{Boolean(chatDisabled) && (
|
|
|
|
<div className="help--notice">
|
2021-07-26 16:27:39 +02:00
|
|
|
{channelName
|
|
|
|
? __('%channelName% has disabled chat for this stream. Enjoy the stream!', { channelName })
|
|
|
|
: __('This channel has disabled chat for this stream. Enjoy the stream!')}
|
2021-06-03 17:55:16 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2021-03-18 18:21:49 +01:00
|
|
|
{!isLive && (
|
|
|
|
<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
|
|
|
|
|
|
|
{isMobile && <LivestreamComments uri={uri} />}
|
|
|
|
|
2021-06-17 20:55:23 +02:00
|
|
|
<FileTitleSection uri={uri} livestream isLive={isLive} />
|
2021-03-10 19:34:21 +01:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|