Fix embed call
This commit is contained in:
parent
777937c7d8
commit
b02f0736fc
2 changed files with 8 additions and 8 deletions
|
@ -9,7 +9,7 @@ import { selectShouldObscurePreviewForUri } from 'redux/selectors/content';
|
||||||
import { selectCostInfoForUri, doFetchCostInfoForUri, selectBlackListedOutpoints } from 'lbryinc';
|
import { selectCostInfoForUri, doFetchCostInfoForUri, selectBlackListedOutpoints } from 'lbryinc';
|
||||||
import { doCommentSocketConnect, doCommentSocketDisconnect } from 'redux/actions/websocket';
|
import { doCommentSocketConnect, doCommentSocketDisconnect } from 'redux/actions/websocket';
|
||||||
import { doFetchActiveLivestreams, doFetchChannelLiveStatus } from 'redux/actions/livestream';
|
import { doFetchActiveLivestreams, doFetchChannelLiveStatus } from 'redux/actions/livestream';
|
||||||
import { selectIsActiveLivestreamForUri, selectActiveLivestreams } from 'redux/selectors/livestream';
|
import { selectIsActiveLivestreamForUri } from 'redux/selectors/livestream';
|
||||||
import { getThumbnailFromClaim, isStreamPlaceholderClaim } from 'util/claim';
|
import { getThumbnailFromClaim, isStreamPlaceholderClaim } from 'util/claim';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
|
@ -30,7 +30,6 @@ const select = (state, props) => {
|
||||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
isCurrentClaimLive: canonicalUrl && selectIsActiveLivestreamForUri(state, canonicalUrl),
|
isCurrentClaimLive: canonicalUrl && selectIsActiveLivestreamForUri(state, canonicalUrl),
|
||||||
isLivestreamClaim: isStreamPlaceholderClaim(claim),
|
isLivestreamClaim: isStreamPlaceholderClaim(claim),
|
||||||
activeLivestreams: selectActiveLivestreams(state),
|
|
||||||
obscurePreview: selectShouldObscurePreviewForUri(state, uri),
|
obscurePreview: selectShouldObscurePreviewForUri(state, uri),
|
||||||
claimThumbnail: getThumbnailFromClaim(claim),
|
claimThumbnail: getThumbnailFromClaim(claim),
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,6 @@ type Props = {
|
||||||
blackListedOutpoints: Array<{ txid: string, nout: number }>,
|
blackListedOutpoints: Array<{ txid: string, nout: number }>,
|
||||||
isCurrentClaimLive: boolean,
|
isCurrentClaimLive: boolean,
|
||||||
isLivestreamClaim: boolean,
|
isLivestreamClaim: boolean,
|
||||||
activeLivestreams: ?any,
|
|
||||||
claimThumbnail?: string,
|
claimThumbnail?: string,
|
||||||
obscurePreview: boolean,
|
obscurePreview: boolean,
|
||||||
doResolveUri: (uri: string) => void,
|
doResolveUri: (uri: string) => void,
|
||||||
|
@ -48,7 +47,6 @@ const EmbedWrapperPage = (props: Props) => {
|
||||||
blackListedOutpoints,
|
blackListedOutpoints,
|
||||||
isCurrentClaimLive,
|
isCurrentClaimLive,
|
||||||
isLivestreamClaim: liveClaim,
|
isLivestreamClaim: liveClaim,
|
||||||
activeLivestreams,
|
|
||||||
claimThumbnail,
|
claimThumbnail,
|
||||||
obscurePreview,
|
obscurePreview,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
|
@ -69,6 +67,7 @@ const EmbedWrapperPage = (props: Props) => {
|
||||||
|
|
||||||
const containerRef = React.useRef<any>();
|
const containerRef = React.useRef<any>();
|
||||||
const [thumbnail, setThumbnail] = React.useState(FileRenderPlaceholder);
|
const [thumbnail, setThumbnail] = React.useState(FileRenderPlaceholder);
|
||||||
|
const [livestreamsFetched, setLivestreamsFetched] = React.useState(false);
|
||||||
|
|
||||||
const channelUrl = channelClaim && formatLbryChannelName(channelClaim.canonical_url);
|
const channelUrl = channelClaim && formatLbryChannelName(channelClaim.canonical_url);
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
|
@ -112,7 +111,10 @@ const EmbedWrapperPage = (props: Props) => {
|
||||||
}, [claimThumbnail, thumbnail]);
|
}, [claimThumbnail, thumbnail]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (doFetchActiveLivestreams) doFetchActiveLivestreams();
|
if (doFetchActiveLivestreams) {
|
||||||
|
doFetchActiveLivestreams();
|
||||||
|
setLivestreamsFetched(true);
|
||||||
|
}
|
||||||
}, [doFetchActiveLivestreams]);
|
}, [doFetchActiveLivestreams]);
|
||||||
|
|
||||||
// Establish web socket connection for viewer count.
|
// Establish web socket connection for viewer count.
|
||||||
|
@ -147,7 +149,7 @@ const EmbedWrapperPage = (props: Props) => {
|
||||||
|
|
||||||
// Find out current channels status + active live claim every 30 seconds
|
// Find out current channels status + active live claim every 30 seconds
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!channelClaim || !activeLivestreams) return;
|
if (!channelClaim || !livestreamsFetched) return;
|
||||||
|
|
||||||
const { claim_id: channelClaimId } = channelClaim || {};
|
const { claim_id: channelClaimId } = channelClaim || {};
|
||||||
|
|
||||||
|
@ -156,8 +158,7 @@ const EmbedWrapperPage = (props: Props) => {
|
||||||
const intervalId = setInterval(() => doFetchChannelLiveStatus(channelClaimId), LIVESTREAM_STATUS_CHECK_INTERVAL);
|
const intervalId = setInterval(() => doFetchChannelLiveStatus(channelClaimId), LIVESTREAM_STATUS_CHECK_INTERVAL);
|
||||||
|
|
||||||
return () => clearInterval(intervalId);
|
return () => clearInterval(intervalId);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
}, [livestreamsFetched, channelClaim, doFetchChannelLiveStatus]);
|
||||||
}, [channelClaim, doFetchChannelLiveStatus]);
|
|
||||||
|
|
||||||
if (isClaimBlackListed) {
|
if (isClaimBlackListed) {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Add table
Reference in a new issue