diff --git a/ui/component/viewers/videoViewer/index.js b/ui/component/viewers/videoViewer/index.js index d9b6ddce1..e0c409379 100644 --- a/ui/component/viewers/videoViewer/index.js +++ b/ui/component/viewers/videoViewer/index.js @@ -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, diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 59b7f6715..cfc4256d6 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -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(function VideoJs(props: Props) { claimId, userId, allowPreRoll, + internalFeatureEnabled, shareTelemetry, replay, videoTheaterMode, @@ -553,11 +555,14 @@ export default React.memo(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); diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 21efebeb5..1043c2835 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -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}