Dont show additional player buttons from markdown and comments
This commit is contained in:
parent
903a7c8afd
commit
37ce82edb4
2 changed files with 56 additions and 67 deletions
|
@ -1,7 +1,6 @@
|
|||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
SETTINGS,
|
||||
COLLECTIONS_CONSTS,
|
||||
|
@ -40,6 +39,7 @@ const select = (state, props) => {
|
|||
const userId = selectUser(state) && selectUser(state).id;
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || (playingUri && playingUri.collectionId);
|
||||
const isMarkdownOrComment = playingUri && (playingUri.source === 'markdown' || playingUri.source === 'comment');
|
||||
|
||||
let nextRecommendedUri;
|
||||
let previousListUri;
|
||||
|
@ -51,24 +51,23 @@ const select = (state, props) => {
|
|||
}
|
||||
|
||||
return {
|
||||
position,
|
||||
userId,
|
||||
collectionId,
|
||||
nextRecommendedUri,
|
||||
previousListUri,
|
||||
isMarkdownOrComment,
|
||||
autoplayIfEmbedded: Boolean(autoplay),
|
||||
autoplayMedia: Boolean(makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state)),
|
||||
autoplayNext: Boolean(makeSelectClientSetting(SETTINGS.AUTOPLAY_NEXT)(state)),
|
||||
autoplayNext: makeSelectClientSetting(SETTINGS.AUTOPLAY_NEXT)(state),
|
||||
volume: selectVolume(state),
|
||||
muted: selectMute(state),
|
||||
videoPlaybackRate: makeSelectClientSetting(SETTINGS.VIDEO_PLAYBACK_RATE)(state),
|
||||
position: position,
|
||||
hasFileInfo: Boolean(makeSelectFileInfoForUri(uri)(state)),
|
||||
thumbnail: makeSelectThumbnailForUri(uri)(state),
|
||||
claim: makeSelectClaimForUri(uri)(state),
|
||||
homepageData: selectHomepageData(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
userId: userId,
|
||||
shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data,
|
||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||
collectionId,
|
||||
nextRecommendedUri,
|
||||
previousListUri,
|
||||
videoTheaterMode: makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state),
|
||||
};
|
||||
};
|
||||
|
|
|
@ -42,7 +42,6 @@ type Props = {
|
|||
videoPlaybackRate: number,
|
||||
volume: number,
|
||||
uri: string,
|
||||
autoplayMedia: boolean,
|
||||
autoplayNext: boolean,
|
||||
autoplayIfEmbedded: boolean,
|
||||
desktopPlayStartTime?: number,
|
||||
|
@ -64,6 +63,7 @@ type Props = {
|
|||
nextRecommendedUri: string,
|
||||
previousListUri: string,
|
||||
videoTheaterMode: boolean,
|
||||
isMarkdownOrComment: boolean,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -84,7 +84,6 @@ function VideoViewer(props: Props) {
|
|||
uri,
|
||||
muted,
|
||||
volume,
|
||||
autoplayMedia,
|
||||
autoplayNext,
|
||||
autoplayIfEmbedded,
|
||||
doAnalyticsView,
|
||||
|
@ -106,6 +105,7 @@ function VideoViewer(props: Props) {
|
|||
nextRecommendedUri,
|
||||
previousListUri,
|
||||
videoTheaterMode,
|
||||
isMarkdownOrComment,
|
||||
} = props;
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||
|
@ -196,7 +196,8 @@ function VideoViewer(props: Props) {
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (doNavigate) {
|
||||
if (!doNavigate) return;
|
||||
|
||||
if (playNextUrl) {
|
||||
if (permanentUrl !== nextRecommendedUri) {
|
||||
if (nextRecommendedUri) {
|
||||
|
@ -221,7 +222,6 @@ function VideoViewer(props: Props) {
|
|||
if (!ended) setDoNavigate(false);
|
||||
setEnded(false);
|
||||
setPlayNextUrl(true);
|
||||
}
|
||||
}, [
|
||||
clearPosition,
|
||||
collectionId,
|
||||
|
@ -236,7 +236,8 @@ function VideoViewer(props: Props) {
|
|||
]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (ended) {
|
||||
if (!ended) return;
|
||||
|
||||
analytics.videoIsPlaying(false);
|
||||
|
||||
if (adUrl) {
|
||||
|
@ -253,20 +254,7 @@ function VideoViewer(props: Props) {
|
|||
}
|
||||
|
||||
clearPosition(uri);
|
||||
}
|
||||
}, [
|
||||
embedded,
|
||||
setIsEndedEmbed,
|
||||
autoplayMedia,
|
||||
setShowAutoplayCountdown,
|
||||
adUrl,
|
||||
setAdUrl,
|
||||
clearPosition,
|
||||
uri,
|
||||
ended,
|
||||
collectionId,
|
||||
autoplayNext,
|
||||
]);
|
||||
}, [adUrl, autoplayNext, clearPosition, collectionId, embedded, ended, setAdUrl, uri]);
|
||||
|
||||
function onPlay(player) {
|
||||
setEnded(false);
|
||||
|
@ -321,6 +309,7 @@ function VideoViewer(props: Props) {
|
|||
player.muted(muted);
|
||||
player.volume(volume);
|
||||
player.playbackRate(videoPlaybackRate);
|
||||
if (!isMarkdownOrComment) {
|
||||
addTheaterModeButton(player, toggleVideoTheaterMode);
|
||||
if (collectionId) {
|
||||
addPlayNextButton(player, doPlayNext);
|
||||
|
@ -329,6 +318,7 @@ function VideoViewer(props: Props) {
|
|||
addAutoplayNextButton(player, toggleAutoplayNext, autoplayNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const shouldPlay = !embedded || autoplayIfEmbedded;
|
||||
// https://blog.videojs.com/autoplay-best-practices-with-video-js/#Programmatic-Autoplay-and-Success-Failure-Detection
|
||||
|
|
Loading…
Reference in a new issue