Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable "save video as" option for content with disabled downloads #3102

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ui/component/viewers/videoViewer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import {
selectPurchaseMadeForClaimId,
selectRentalTagForUri,
selectProtectedContentTagForUri,
makeSelectTagInClaimOrChannelForUri,
} from 'redux/selectors/claims';
import { isStreamPlaceholderClaim, getChannelIdFromClaim } from 'util/claim';
import { selectActiveLivestreamForChannel } from 'redux/selectors/livestream';
import { selectNextUriForUriInPlayingCollectionForId } from 'redux/selectors/collections';
import * as SETTINGS from 'constants/settings';
import * as TAGS from 'constants/tags';
import {
doChangeVolume,
doChangeMute,
Expand Down Expand Up @@ -89,6 +91,7 @@ const select = (state, props) => {
isRentableContent: Boolean(selectRentalTagForUri(state, props.uri)),
purchaseMadeForClaimId: selectPurchaseMadeForClaimId(state, claim.claim_id),
isProtectedContent: Boolean(selectProtectedContentTagForUri(state, uri)),
isDownloadDisabled: makeSelectTagInClaimOrChannelForUri(uri, TAGS.DISABLE_DOWNLOAD_BUTTON_TAG)(state),
recomendedContent: selectRecommendedContentForUri(state, props.uri),
};
};
Expand Down
4 changes: 3 additions & 1 deletion ui/component/viewers/videoViewer/internal/videojs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type Props = {
isPurchasableContent: boolean,
isRentableContent: boolean,
isProtectedContent: boolean,
isDownloadDisabled: boolean,
isUnlisted: boolean,
doSetVideoSourceLoaded: (uri: string) => void,
};
Expand Down Expand Up @@ -188,6 +189,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
isPurchasableContent,
isRentableContent,
isProtectedContent,
isDownloadDisabled,
isUnlisted,
doSetVideoSourceLoaded,
} = props;
Expand Down Expand Up @@ -537,7 +539,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
}

// disable right-click (context-menu) for purchased content
if (isPurchasableContent || isRentableContent || isProtectedContent || isUnlisted) {
if (isPurchasableContent || isRentableContent || isProtectedContent || isUnlisted || isDownloadDisabled) {
const player = document.querySelector('video.vjs-tech');
if (player) player.setAttribute('oncontextmenu', 'return false;');
}
Expand Down
3 changes: 3 additions & 0 deletions ui/component/viewers/videoViewer/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type Props = {
isRentableContent: boolean,
purchaseMadeForClaimId: boolean,
isProtectedContent: boolean,
isDownloadDisabled: boolean,
doSetShowAutoplayCountdownForUri: (params: { uri: ?string, show: boolean }) => void,
doSetVideoSourceLoaded: (uri: string) => void,
};
Expand Down Expand Up @@ -143,6 +144,7 @@ function VideoViewer(props: Props) {
isPurchasableContent,
isRentableContent,
isProtectedContent,
isDownloadDisabled,
doSetShowAutoplayCountdownForUri,
doSetVideoSourceLoaded,
} = props;
Expand Down Expand Up @@ -621,6 +623,7 @@ function VideoViewer(props: Props) {
isPurchasableContent={isPurchasableContent}
isRentableContent={isRentableContent}
isProtectedContent={isProtectedContent}
isDownloadDisabled={isDownloadDisabled}
isUnlisted={isClaimUnlisted(claim)}
doSetVideoSourceLoaded={doSetVideoSourceLoaded}
/>
Expand Down
Loading