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",
"Card Last 4": "Card Last 4",
"Search blocked channel name": "Search blocked channel name",
"Discuss": "Discuss",
"--end--": "--end--"
}

View file

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

View file

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

View file

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

View file

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