revert embedNoEnd and modify preferEmbed end display

This commit is contained in:
zeppi 2021-09-21 11:38:12 -04:00
parent b42e882a02
commit 8335974963
3 changed files with 20 additions and 25 deletions

View file

@ -6,7 +6,6 @@ import {
COLLECTIONS_CONSTS, COLLECTIONS_CONSTS,
makeSelectNextUrlForCollectionAndUrl, makeSelectNextUrlForCollectionAndUrl,
makeSelectPreviousUrlForCollectionAndUrl, makeSelectPreviousUrlForCollectionAndUrl,
makeSelectTagInClaimOrChannelForUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { import {
doChangeVolume, doChangeVolume,
@ -25,7 +24,6 @@ import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
import { selectDaemonSettings, makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings'; import { selectDaemonSettings, makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
import { toggleVideoTheaterMode, toggleAutoplayNext, doSetClientSetting } from 'redux/actions/settings'; import { toggleVideoTheaterMode, toggleAutoplayNext, doSetClientSetting } from 'redux/actions/settings';
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user'; import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
import { PREFERENCE_EMBED } from 'constants/tags';
const select = (state, props) => { const select = (state, props) => {
const { search } = props.location; const { search } = props.location;
@ -56,7 +54,6 @@ const select = (state, props) => {
nextRecommendedUri, nextRecommendedUri,
previousListUri, previousListUri,
isMarkdownOrComment, isMarkdownOrComment,
preferEmbed: makeSelectTagInClaimOrChannelForUri(props.uri, PREFERENCE_EMBED)(state),
autoplayIfEmbedded: Boolean(autoplay), autoplayIfEmbedded: Boolean(autoplay),
autoplayNext: makeSelectClientSetting(SETTINGS.AUTOPLAY_NEXT)(state), autoplayNext: makeSelectClientSetting(SETTINGS.AUTOPLAY_NEXT)(state),
volume: selectVolume(state), volume: selectVolume(state),

View file

@ -64,7 +64,6 @@ type Props = {
previousListUri: string, previousListUri: string,
videoTheaterMode: boolean, videoTheaterMode: boolean,
isMarkdownOrComment: boolean, isMarkdownOrComment: boolean,
preferEmbed: boolean,
}; };
/* /*
@ -107,7 +106,6 @@ function VideoViewer(props: Props) {
previousListUri, previousListUri,
videoTheaterMode, videoTheaterMode,
isMarkdownOrComment, isMarkdownOrComment,
preferEmbed,
} = props; } = props;
const permanentUrl = claim && claim.permanent_url; const permanentUrl = claim && claim.permanent_url;
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : []; const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
@ -355,9 +353,7 @@ function VideoViewer(props: Props) {
// first play tracking, used for initializing the watchman api // first play tracking, used for initializing the watchman api
player.on('tracking:firstplay', doTrackingFirstPlay); player.on('tracking:firstplay', doTrackingFirstPlay);
player.on('ended', () => { player.on('ended', () => setEnded(true));
if (!preferEmbed) setEnded(true);
});
player.on('play', onPlay); player.on('play', onPlay);
player.on('pause', (event) => onPause(event, player)); player.on('pause', (event) => onPause(event, player));
player.on('dispose', (event) => onDispose(event, player)); player.on('dispose', (event) => onDispose(event, player));

View file

@ -44,23 +44,25 @@ function FileViewerEmbeddedEnded(props: Props) {
<Logo type={'embed'} /> <Logo type={'embed'} />
</Button> </Button>
</div> </div>
{!preferEmbed && (
<div className="file-viewer__overlay-title file-viewer_embed-ended-title">
<p>{prompt}</p>
</div>
<div className="file-viewer__overlay-actions">
<> <>
<div className="file-viewer__overlay-title file-viewer_embed-ended-title"> {showReplay && (
<p>{prompt}</p> <Button
</div> title={__('Replay')}
<div className="file-viewer__overlay-actions"> button="link"
label={preferEmbed ? __('Replay') : undefined}
iconRight={ICONS.REPLAY}
onClick={() => {
if (window.player) window.player.play();
}}
/>
)}
{!preferEmbed && (
<> <>
{showReplay && (
<Button
title={__('Replay')}
button="link"
iconRight={ICONS.REPLAY}
onClick={() => {
if (window.player) window.player.play();
}}
/>
)}
<Button label={__('Discuss')} iconRight={ICONS.EXTERNAL} button="primary" href={lbrytvLink} /> <Button label={__('Discuss')} iconRight={ICONS.EXTERNAL} button="primary" href={lbrytvLink} />
{!isAuthenticated && ( {!isAuthenticated && (
<Button <Button
@ -70,9 +72,9 @@ function FileViewerEmbeddedEnded(props: Props) {
/> />
)} )}
</> </>
</div> )}
</> </>
)} </div>
</div> </div>
); );
} }