enable show internal feature

This commit is contained in:
Anthony 2021-10-11 18:56:50 +03:00
parent 59a9f46c29
commit 85447185a8
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
3 changed files with 15 additions and 4 deletions

View file

@ -30,9 +30,11 @@ const select = (state, props) => {
const urlParams = new URLSearchParams(search);
const autoplay = urlParams.get('autoplay');
const uri = props.uri;
// TODO: eventually this should be received from DB and not local state (https://github.com/lbryio/lbry-desktop/issues/6796)
const position = urlParams.get('t') !== null ? urlParams.get('t') : makeSelectContentPositionForUri(uri)(state);
const userId = selectUser(state) && selectUser(state).id;
const internalFeature = selectUser(state) && selectUser(state).internal_feature;
const playingUri = selectPlayingUri(state);
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || (playingUri && playingUri.collectionId);
const isMarkdownOrComment = playingUri && (playingUri.source === 'markdown' || playingUri.source === 'comment');
@ -50,6 +52,7 @@ const select = (state, props) => {
return {
position,
userId,
internalFeature,
collectionId,
nextRecommendedUri,
previousListUri,

View file

@ -60,7 +60,8 @@ type Props = {
adUrl: ?string,
claimId: ?string,
userId: ?number,
// allowPreRoll: ?boolean,
allowPreRoll: ?boolean,
internalFeatureEnabled: ?boolean,
shareTelemetry: boolean,
replay: boolean,
videoTheaterMode: boolean,
@ -193,6 +194,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
claimId,
userId,
allowPreRoll,
internalFeatureEnabled,
shareTelemetry,
replay,
videoTheaterMode,
@ -553,11 +555,14 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// this seems like a weird thing to have to check for here
if (!player) return;
if (allowPreRoll && hitsTwentyPercent()) {
// always have ads on if internal feature is on,
// otherwise if not authed, roll for 20% to see an ad
const shouldShowAnAd = internalFeatureEnabled || (allowPreRoll && hitsTwentyPercent());
if (shouldShowAnAd) {
vjs.aniview();
}
// Add various event listeners to player
player.one('play', onInitialPlay);
player.on('play', resolveCtrlText);

View file

@ -55,6 +55,7 @@ type Props = {
setVideoPlaybackRate: (number) => void,
authenticated: boolean,
userId: number,
internalFeature: boolean,
homepageData?: { [string]: HomepageCat },
shareTelemetry: boolean,
isFloating: boolean,
@ -98,6 +99,7 @@ function VideoViewer(props: Props) {
homepageData,
authenticated,
userId,
internalFeature,
shareTelemetry,
isFloating,
doPlayUri,
@ -467,7 +469,8 @@ function VideoViewer(props: Props) {
autoplaySetting={autoplayNext}
claimId={claimId}
userId={userId}
allowPreRoll={!authenticated}
allowPreRoll={!authenticated} // used to not include embeds, removed for now
internalFeatureEnabled={internalFeature}
shareTelemetry={shareTelemetry}
replay={replay}
videoTheaterMode={videoTheaterMode}