Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ type Props = {
fallbackImageAlt: CardPictureProps['alt'];
fallbackImageAspectRatio: CardPictureProps['aspectRatio'];
linkTo: string;
/**
* If CORS are enabled, the video request will include CORS headers.
*/
enableCors?: boolean;
subtitleSource?: string;
subtitleSize: SubtitleSize;
};
Expand All @@ -158,6 +162,7 @@ export const SelfHostedVideo = ({
fallbackImageAlt,
fallbackImageAspectRatio,
linkTo,
enableCors = true,
subtitleSource,
subtitleSize,
}: Props) => {
Expand Down Expand Up @@ -706,6 +711,7 @@ export const SelfHostedVideo = ({
AudioIcon={hasAudio ? AudioIcon : null}
preloadPartialData={preloadPartialData}
showPlayIcon={showPlayIcon}
enableCors={enableCors}
subtitleSource={subtitleSource}
subtitleSize={subtitleSize}
activeCue={activeCue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const Loop5to4: Story = {
uniqueId: 'test-video-1',
atomId: 'test-atom-1',
videoStyle: 'Loop',
enableCors: false,
height: 720,
width: 900,
posterImage:
Expand Down
8 changes: 4 additions & 4 deletions dotcom-rendering/src/components/SelfHostedVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type Props = {
posterImage?: string;
preloadPartialData: boolean;
showPlayIcon: boolean;
enableCors?: boolean;
subtitleSource?: string;
subtitleSize?: SubtitleSize;
/* used in custom subtitle overlays */
Expand All @@ -131,12 +132,10 @@ type Props = {
/**
* Note that in React 19, forwardRef is no longer necessary:
* https://react.dev/reference/react/forwardRef
*/
/**
*
* NB: To develop the video player locally, use `https://r.thegulocal.com/` instead of `localhost`.
* This is required because CORS restrictions prevent accessing the subtitles and video file from localhost.
*/

export const SelfHostedVideoPlayer = forwardRef(
(
{
Expand Down Expand Up @@ -164,6 +163,7 @@ export const SelfHostedVideoPlayer = forwardRef(
AudioIcon,
preloadPartialData,
showPlayIcon,
enableCors = true,
subtitleSource,
subtitleSize,
activeCue,
Expand Down Expand Up @@ -194,7 +194,7 @@ export const SelfHostedVideoPlayer = forwardRef(
videoStyles(width, height),
showSubtitles && subtitleStyles(subtitleSize),
]}
crossOrigin="anonymous"
crossOrigin={enableCors ? 'anonymous' : undefined}
ref={ref}
tabIndex={0}
data-testid="self-hosted-video-player"
Expand Down
3 changes: 2 additions & 1 deletion dotcom-rendering/src/layouts/FrontLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ export const FrontLayout = ({ front, NAV }: Props) => {

const contributionsServiceUrl = getContributionsServiceUrl(front);

/** We allow the labs redesign to be shown if:
/**
* We allow the labs redesign to be shown if:
* - the feature switch is ON
* OR
* - the user is opted into the 0% server side test
Expand Down
Loading