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 { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectFileInfoForUri,
|
|
||||||
makeSelectThumbnailForUri,
|
makeSelectThumbnailForUri,
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
COLLECTIONS_CONSTS,
|
COLLECTIONS_CONSTS,
|
||||||
|
@ -40,6 +39,7 @@ const select = (state, props) => {
|
||||||
const userId = selectUser(state) && selectUser(state).id;
|
const userId = selectUser(state) && selectUser(state).id;
|
||||||
const playingUri = selectPlayingUri(state);
|
const playingUri = selectPlayingUri(state);
|
||||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || (playingUri && playingUri.collectionId);
|
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || (playingUri && playingUri.collectionId);
|
||||||
|
const isMarkdownOrComment = playingUri && (playingUri.source === 'markdown' || playingUri.source === 'comment');
|
||||||
|
|
||||||
let nextRecommendedUri;
|
let nextRecommendedUri;
|
||||||
let previousListUri;
|
let previousListUri;
|
||||||
|
@ -51,24 +51,23 @@ const select = (state, props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
position,
|
||||||
|
userId,
|
||||||
|
collectionId,
|
||||||
|
nextRecommendedUri,
|
||||||
|
previousListUri,
|
||||||
|
isMarkdownOrComment,
|
||||||
autoplayIfEmbedded: Boolean(autoplay),
|
autoplayIfEmbedded: Boolean(autoplay),
|
||||||
autoplayMedia: Boolean(makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state)),
|
autoplayNext: makeSelectClientSetting(SETTINGS.AUTOPLAY_NEXT)(state),
|
||||||
autoplayNext: Boolean(makeSelectClientSetting(SETTINGS.AUTOPLAY_NEXT)(state)),
|
|
||||||
volume: selectVolume(state),
|
volume: selectVolume(state),
|
||||||
muted: selectMute(state),
|
muted: selectMute(state),
|
||||||
videoPlaybackRate: makeSelectClientSetting(SETTINGS.VIDEO_PLAYBACK_RATE)(state),
|
videoPlaybackRate: makeSelectClientSetting(SETTINGS.VIDEO_PLAYBACK_RATE)(state),
|
||||||
position: position,
|
|
||||||
hasFileInfo: Boolean(makeSelectFileInfoForUri(uri)(state)),
|
|
||||||
thumbnail: makeSelectThumbnailForUri(uri)(state),
|
thumbnail: makeSelectThumbnailForUri(uri)(state),
|
||||||
claim: makeSelectClaimForUri(uri)(state),
|
claim: makeSelectClaimForUri(uri)(state),
|
||||||
homepageData: selectHomepageData(state),
|
homepageData: selectHomepageData(state),
|
||||||
authenticated: selectUserVerifiedEmail(state),
|
authenticated: selectUserVerifiedEmail(state),
|
||||||
userId: userId,
|
|
||||||
shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data,
|
shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data,
|
||||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||||
collectionId,
|
|
||||||
nextRecommendedUri,
|
|
||||||
previousListUri,
|
|
||||||
videoTheaterMode: makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state),
|
videoTheaterMode: makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,6 @@ type Props = {
|
||||||
videoPlaybackRate: number,
|
videoPlaybackRate: number,
|
||||||
volume: number,
|
volume: number,
|
||||||
uri: string,
|
uri: string,
|
||||||
autoplayMedia: boolean,
|
|
||||||
autoplayNext: boolean,
|
autoplayNext: boolean,
|
||||||
autoplayIfEmbedded: boolean,
|
autoplayIfEmbedded: boolean,
|
||||||
desktopPlayStartTime?: number,
|
desktopPlayStartTime?: number,
|
||||||
|
@ -64,6 +63,7 @@ type Props = {
|
||||||
nextRecommendedUri: string,
|
nextRecommendedUri: string,
|
||||||
previousListUri: string,
|
previousListUri: string,
|
||||||
videoTheaterMode: boolean,
|
videoTheaterMode: boolean,
|
||||||
|
isMarkdownOrComment: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -84,7 +84,6 @@ function VideoViewer(props: Props) {
|
||||||
uri,
|
uri,
|
||||||
muted,
|
muted,
|
||||||
volume,
|
volume,
|
||||||
autoplayMedia,
|
|
||||||
autoplayNext,
|
autoplayNext,
|
||||||
autoplayIfEmbedded,
|
autoplayIfEmbedded,
|
||||||
doAnalyticsView,
|
doAnalyticsView,
|
||||||
|
@ -106,6 +105,7 @@ function VideoViewer(props: Props) {
|
||||||
nextRecommendedUri,
|
nextRecommendedUri,
|
||||||
previousListUri,
|
previousListUri,
|
||||||
videoTheaterMode,
|
videoTheaterMode,
|
||||||
|
isMarkdownOrComment,
|
||||||
} = props;
|
} = props;
|
||||||
const permanentUrl = claim && claim.permanent_url;
|
const permanentUrl = claim && claim.permanent_url;
|
||||||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||||
|
@ -196,32 +196,32 @@ function VideoViewer(props: Props) {
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (doNavigate) {
|
if (!doNavigate) return;
|
||||||
if (playNextUrl) {
|
|
||||||
if (permanentUrl !== nextRecommendedUri) {
|
if (playNextUrl) {
|
||||||
if (nextRecommendedUri) {
|
if (permanentUrl !== nextRecommendedUri) {
|
||||||
if (collectionId) clearPosition(permanentUrl);
|
if (nextRecommendedUri) {
|
||||||
doPlay(nextRecommendedUri);
|
if (collectionId) clearPosition(permanentUrl);
|
||||||
}
|
doPlay(nextRecommendedUri);
|
||||||
} else {
|
|
||||||
setReplay(true);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (videoNode) {
|
setReplay(true);
|
||||||
const currentTime = videoNode.currentTime;
|
}
|
||||||
|
} else {
|
||||||
if (currentTime <= 5) {
|
if (videoNode) {
|
||||||
if (previousListUri && permanentUrl !== previousListUri) doPlay(previousListUri);
|
const currentTime = videoNode.currentTime;
|
||||||
} else {
|
|
||||||
videoNode.currentTime = 0;
|
if (currentTime <= 5) {
|
||||||
}
|
if (previousListUri && permanentUrl !== previousListUri) doPlay(previousListUri);
|
||||||
setDoNavigate(false);
|
} else {
|
||||||
}
|
videoNode.currentTime = 0;
|
||||||
|
}
|
||||||
|
setDoNavigate(false);
|
||||||
}
|
}
|
||||||
if (!ended) setDoNavigate(false);
|
|
||||||
setEnded(false);
|
|
||||||
setPlayNextUrl(true);
|
|
||||||
}
|
}
|
||||||
|
if (!ended) setDoNavigate(false);
|
||||||
|
setEnded(false);
|
||||||
|
setPlayNextUrl(true);
|
||||||
}, [
|
}, [
|
||||||
clearPosition,
|
clearPosition,
|
||||||
collectionId,
|
collectionId,
|
||||||
|
@ -236,37 +236,25 @@ function VideoViewer(props: Props) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (ended) {
|
if (!ended) return;
|
||||||
analytics.videoIsPlaying(false);
|
|
||||||
|
|
||||||
if (adUrl) {
|
analytics.videoIsPlaying(false);
|
||||||
setAdUrl(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (embedded) {
|
if (adUrl) {
|
||||||
setIsEndedEmbed(true);
|
setAdUrl(null);
|
||||||
} else if (!collectionId && autoplayNext) {
|
return;
|
||||||
setShowAutoplayCountdown(true);
|
|
||||||
} else if (collectionId) {
|
|
||||||
setDoNavigate(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearPosition(uri);
|
|
||||||
}
|
}
|
||||||
}, [
|
|
||||||
embedded,
|
if (embedded) {
|
||||||
setIsEndedEmbed,
|
setIsEndedEmbed(true);
|
||||||
autoplayMedia,
|
} else if (!collectionId && autoplayNext) {
|
||||||
setShowAutoplayCountdown,
|
setShowAutoplayCountdown(true);
|
||||||
adUrl,
|
} else if (collectionId) {
|
||||||
setAdUrl,
|
setDoNavigate(true);
|
||||||
clearPosition,
|
}
|
||||||
uri,
|
|
||||||
ended,
|
clearPosition(uri);
|
||||||
collectionId,
|
}, [adUrl, autoplayNext, clearPosition, collectionId, embedded, ended, setAdUrl, uri]);
|
||||||
autoplayNext,
|
|
||||||
]);
|
|
||||||
|
|
||||||
function onPlay(player) {
|
function onPlay(player) {
|
||||||
setEnded(false);
|
setEnded(false);
|
||||||
|
@ -321,12 +309,14 @@ function VideoViewer(props: Props) {
|
||||||
player.muted(muted);
|
player.muted(muted);
|
||||||
player.volume(volume);
|
player.volume(volume);
|
||||||
player.playbackRate(videoPlaybackRate);
|
player.playbackRate(videoPlaybackRate);
|
||||||
addTheaterModeButton(player, toggleVideoTheaterMode);
|
if (!isMarkdownOrComment) {
|
||||||
if (collectionId) {
|
addTheaterModeButton(player, toggleVideoTheaterMode);
|
||||||
addPlayNextButton(player, doPlayNext);
|
if (collectionId) {
|
||||||
addPlayPreviousButton(player, doPlayPrevious);
|
addPlayNextButton(player, doPlayNext);
|
||||||
} else {
|
addPlayPreviousButton(player, doPlayPrevious);
|
||||||
addAutoplayNextButton(player, toggleAutoplayNext, autoplayNext);
|
} else {
|
||||||
|
addAutoplayNextButton(player, toggleAutoplayNext, autoplayNext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue