Compare commits

...

3 commits

Author SHA1 Message Date
zeppi
8335974963 revert embedNoEnd and modify preferEmbed end display 2021-09-21 11:38:12 -04:00
infinite-persistence
b42e882a02 Embed: resize "ended message" based on container height 2021-09-21 11:32:47 -04:00
infinite-persistence
9ec5a7c298 Embed: add replay button
Also, changed "Rewatch or Discuss" to "Discuss + external arrow" since there is a dedicated re-watch button.
2021-09-21 11:32:46 -04:00
5 changed files with 33 additions and 16 deletions

View file

@ -2169,5 +2169,6 @@
"Content Page": "Content Page", "Content Page": "Content Page",
"Card Last 4": "Card Last 4", "Card Last 4": "Card Last 4",
"Search blocked channel name": "Search blocked channel name", "Search blocked channel name": "Search blocked channel name",
"Discuss": "Discuss",
"--end--": "--end--" "--end--": "--end--"
} }

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

@ -196,7 +196,11 @@
} }
.file-viewer_embed-ended-title { .file-viewer_embed-ended-title {
white-space: pre-wrap; max-width: 100%;
p {
font-size: 6vh;
white-space: pre-wrap;
}
} }
.content__viewer--floating { .content__viewer--floating {
@ -231,6 +235,10 @@
.button + .button { .button + .button {
margin-left: var(--spacing-m); margin-left: var(--spacing-m);
} }
.button--link {
vertical-align: middle;
}
} }
.file-viewer__overlay-logo { .file-viewer__overlay-logo {

View file

@ -1,6 +1,7 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import * as ICONS from 'constants/icons';
import { formatLbryUrlForWeb } from 'util/url'; import { formatLbryUrlForWeb } from 'util/url';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { URL, SITE_NAME } from 'config'; import { URL, SITE_NAME } from 'config';
@ -34,6 +35,7 @@ function FileViewerEmbeddedEnded(props: Props) {
// $FlowFixMe // $FlowFixMe
const prompt = prompts[promptKey]; const prompt = prompts[promptKey];
const lbrytvLink = `${URL}${formatLbryUrlForWeb(uri)}?src=${promptKey}`; const lbrytvLink = `${URL}${formatLbryUrlForWeb(uri)}?src=${promptKey}`;
const showReplay = Boolean(window.player);
return ( return (
<div className="file-viewer__overlay"> <div className="file-viewer__overlay">
@ -42,13 +44,26 @@ 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">{prompt}</div> {showReplay && (
<div className="file-viewer__overlay-actions"> <Button
{ /* add button to replay? */ } title={__('Replay')}
button="link"
label={preferEmbed ? __('Replay') : undefined}
iconRight={ICONS.REPLAY}
onClick={() => {
if (window.player) window.player.play();
}}
/>
)}
{!preferEmbed && (
<> <>
<Button label={__('Rewatch or Discuss')} button="primary" href={lbrytvLink} /> <Button label={__('Discuss')} iconRight={ICONS.EXTERNAL} button="primary" href={lbrytvLink} />
{!isAuthenticated && ( {!isAuthenticated && (
<Button <Button
label={__('Join %SITE_NAME%', { SITE_NAME })} label={__('Join %SITE_NAME%', { SITE_NAME })}
@ -57,9 +72,9 @@ function FileViewerEmbeddedEnded(props: Props) {
/> />
)} )}
</> </>
</div> )}
</> </>
)} </div>
</div> </div>
); );
} }