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

[COTECH-506] Default player set for 100% of the traffic. #183

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React, { useRef, useState } from 'react';
import React, { useRef } from 'react';
import UnmuteButton from 'jwplayer/players/DesktopArticleVideoPlayer/UnmuteButton';
import JwPlayerWrapper from 'jwplayer/players/shared/JwPlayerWrapper';
import VideoDetails from 'jwplayer/players/DesktopArticleVideoPlayer/VideoDetails';
import useOnScreen from 'utils/useOnScreen';
import useAdComplete from 'jwplayer/utils/useAdComplete';
import PlayerWrapper from 'jwplayer/players/shared/PlayerWrapper';
import { DesktopArticleVideoPlayerProps } from 'jwplayer/types';
import CloseButton from 'jwplayer/players/shared/CloseButton/CloseButton';
import Attribution from 'jwplayer/players/DesktopArticleVideoPlayer/Attribution';
import { getArticleVideoConfig } from 'jwplayer/utils/articleVideo/articleVideoConfig';
import articlePlayerOnReady from 'jwplayer/utils/articleVideo/articlePlayerOnReady';
Expand All @@ -17,9 +14,6 @@ import styles from './DesktopArticleVideoPlayer.module.css';
export const DesktopArticleVideoPlayerContent: React.FC<DesktopArticleVideoPlayerProps> = ({ videoDetails }) => {
const placeholderRef = useRef<HTMLDivElement>(null);
const adComplete = useAdComplete();
const onScreen = useOnScreen(placeholderRef, '0px', 0.5);
const [dismissed, setDismissed] = useState(false);
const isScrollPlayer = !(dismissed || onScreen);
const controlbar = document.querySelector<HTMLElement>('.jw-controlbar');
const shareIcon = document.querySelector<HTMLElement>('.jw-controlbar .jw-button-container .jw-settings-sharing');
const moreVideosIcon = document.querySelector<HTMLElement>('.jw-controlbar .jw-button-container .jw-related-btn');
Expand All @@ -28,41 +22,25 @@ export const DesktopArticleVideoPlayerContent: React.FC<DesktopArticleVideoPlaye

const getDismissed = getDismissedFn(inputName);

if (onScreen) {
if (controlbar) controlbar.style.background = 'rgba(0, 0, 0, 0.5)';
if (shareIcon) shareIcon.style.display = 'flex';
if (moreVideosIcon) moreVideosIcon.style.display = 'flex';
if (pipIcon) pipIcon.style.display = 'flex';
} else {
if (controlbar) controlbar.style.background = 'linear-gradient(0,#000,transparent)';
if (shareIcon) shareIcon.style.display = 'none';
if (moreVideosIcon) moreVideosIcon.style.display = 'none';
if (pipIcon) pipIcon.style.display = 'none';
}
if (controlbar) controlbar.style.background = 'rgba(0, 0, 0, 0.5)';
if (shareIcon) shareIcon.style.display = 'flex';
if (moreVideosIcon) moreVideosIcon.style.display = 'flex';
if (pipIcon) pipIcon.style.display = 'flex';

return (
<>
<div className={styles.desktopArticleVideoTopPlaceholder} ref={placeholderRef}>
{adComplete && (
<div
className={
isScrollPlayer ? styles.desktopArticleVideoWrapperScrollPlayer : styles.desktopArticleVideoWrapper
}
>
<div className={styles.desktopArticleVideoWrapper}>
<div className={styles.topBar}>
{!isScrollPlayer && <UnmuteButton />}
dzawada marked this conversation as resolved.
Show resolved Hide resolved
{isScrollPlayer && (
<CloseButton dismiss={() => setDismissed(true)} iconColor={'#fff'} className={styles.closeButton} />
)}
<UnmuteButton />
</div>
<JwPlayerWrapper
getDismissed={getDismissed}
config={getArticleVideoConfig(videoDetails)}
onReady={(playerInstance) => articlePlayerOnReady(videoDetails, playerInstance)}
stopAutoAdvanceOnExitViewport={false}
/>
{isScrollPlayer && <VideoDetails />}
<input type="hidden" value={String(dismissed)} name={inputName} />
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/jwplayer/players/shared/JwPlayerWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ declare let window: WindowJWPlayer;
const getDefaultPlayerUrl = () => {
return navigator.userAgent.match(/android/i)
? 'https://cdn.jwplayer.com/libraries/MFqndUHM.js'
: 'https://content.jwplatform.com/libraries/VXc5h4Tf.js';
: 'https://cdn.jwplayer.com/libraries/UKcdkcuf.js';
};

const JwPlayerWrapper: React.FC<JwPlayerWrapperProps> = ({
Expand Down
6 changes: 0 additions & 6 deletions src/loaders/DesktopArticleVideoLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { eligibleForVimeoTakeover, getVimeoTakeoverDetails } from 'loaders/utils
import defineExperiment from '@fandom/pathfinder-lite/experiments/defineExperiment';
import getExperiment from '@fandom/pathfinder-lite/experiments/getExperiment';
import { Experiment } from '@fandom/pathfinder-lite/types';
import checkUserGeo from 'utils/experiments/checkUserGeo';

export { getVideoPlayerVersion } from 'loaders/utils/GetVersion';

Expand Down Expand Up @@ -73,11 +72,6 @@ export const DesktopArticleVideoLoader: React.FC<DesktopArticleVideoLoaderProps>
setPlayer(<VimeoDesktopArticleVideoPlayer vimeoDetails={vimeoTakeoverDetails} />),
);
return;
} else if (currentExperiment?.name === desktopJwFloatOnScrollExperiment?.name && checkUserGeo(['us'])) {
import('experimental/players/DesktopFloatOnScrollArticleVideoPlayer/DesktopFloatOnScrollArticleVideoPlayer').then(
({ default: DesktopFloatOnScrollArticleVideoPlayer }) =>
setPlayer(<DesktopFloatOnScrollArticleVideoPlayer videoDetails={videoDetails} />),
);
} else {
switch (currentExperiment?.name) {
case desktopPauseAfterThreePlaysExperiment.name:
Expand Down
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export { default as JWCanonicalVideoPlayer } from 'jwplayer/players/CanonicalVid

export { default as JWDesktopReskinnedArticleVideoPlayer } from 'experimental/players/DesktopReskinnedArticleVideoPlayer/DesktopReskinnedArticleVideoPlayer';

export { default as DesktopFloatOnScrollArticleVideoPlayer } from 'experimental/players/DesktopFloatOnScrollArticleVideoPlayer/DesktopFloatOnScrollArticleVideoPlayer';

export { default as RedVentureVideoPlayer } from 'jwplayer/players/RedVentureVideoPlayer/RedVentureVideoPlayer';

export { default as YoutubeDesktopArticleVideoPlayer } from 'youtube/players/YoutubeDesktopArticleVideoPlayer';
Expand Down
2 changes: 1 addition & 1 deletion stand-alone/loaderHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface RedVenturePlayerContext extends JwPlayerContainerId {
* More information on this can be found at - https://docs.jwplayer.com/platform/reference/protect-your-content-with-signed-urls#types-of-signed-urls
* @example - unsigned URL example
* {
* playerUrl: 'https://cdn.jwplayer.com/libraries/VXc5h4Tf.js'
* playerUrl: 'https://cdn.jwplayer.com/libraries/UKcdkcuf.js'
* },
* @example - signed URL example
* {
Expand Down