Skip to content

Commit 6de91a0

Browse files
committed
Make video crossOrigin undefined if no subtitles
1 parent 08bc2d6 commit 6de91a0

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

dotcom-rendering/src/components/SelfHostedVideo.stories.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const meta = {
2020
export default meta;
2121
type Story = StoryObj<typeof SelfHostedVideo>;
2222

23-
export const Loop4to5: Story = {
24-
name: 'Looping video in 4:5 aspect ratio',
23+
export const Loop5to4: Story = {
24+
name: 'Looping video in 5:4 aspect ratio',
2525
args: {
2626
sources: [
2727
{
@@ -31,6 +31,7 @@ export const Loop4to5: Story = {
3131
],
3232
uniqueId: 'test-video-1',
3333
atomId: 'test-atom-1',
34+
videoStyle: 'Loop',
3435
height: 720,
3536
width: 900,
3637
posterImage:
@@ -59,7 +60,7 @@ export const Loop4to5: Story = {
5960
export const Loop16to9: Story = {
6061
name: 'Looping video in 16:9 aspect ratio',
6162
args: {
62-
...Loop4to5.args,
63+
...Loop5to4.args,
6364
sources: [
6465
{
6566
src: 'https://uploads.guim.co.uk/2024/10/01/241001HeleneLoop_2.mp4',
@@ -73,13 +74,13 @@ export const Loop16to9: Story = {
7374

7475
export const WithCinemagraph: Story = {
7576
args: {
76-
...Loop4to5.args,
77+
...Loop5to4.args,
7778
videoStyle: 'Cinemagraph',
7879
},
7980
};
8081

8182
export const PausePlay: Story = {
82-
...Loop4to5,
83+
...Loop5to4,
8384
name: 'Pause and play interaction',
8485
play: async ({ canvasElement }) => {
8586
const canvas = within(canvasElement);
@@ -100,7 +101,7 @@ export const PausePlay: Story = {
100101
};
101102

102103
export const UnmuteMute: Story = {
103-
...Loop4to5,
104+
...Loop5to4,
104105
name: 'Unmute and mute interaction',
105106
parameters: {
106107
test: {
@@ -127,7 +128,7 @@ function sleep(ms: number) {
127128
}
128129

129130
export const InteractionObserver: Story = {
130-
...Loop4to5,
131+
...Loop5to4,
131132
name: 'Interaction observer',
132133
render: (args) => (
133134
<div data-testid="test-container">

dotcom-rendering/src/components/SelfHostedVideoPlayer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ type Props = {
9999
sources: Source[];
100100
atomId: string;
101101
uniqueId: string;
102-
width: number;
103102
height: number;
103+
width: number;
104104
videoStyle: VideoPlayerFormat;
105105
FallbackImageComponent: ReactElement;
106106
isPlayable: boolean;
@@ -141,8 +141,8 @@ export const SelfHostedVideoPlayer = forwardRef(
141141
sources,
142142
atomId,
143143
uniqueId,
144-
width,
145144
height,
145+
width,
146146
videoStyle,
147147
FallbackImageComponent,
148148
posterImage,
@@ -192,7 +192,7 @@ export const SelfHostedVideoPlayer = forwardRef(
192192
videoStyles(width, height),
193193
showSubtitles && subtitleStyles(subtitleSize),
194194
]}
195-
crossOrigin="anonymous"
195+
crossOrigin={showSubtitles ? 'anonymous' : undefined}
196196
ref={ref}
197197
tabIndex={0}
198198
data-testid="self-hosted-video-player"

0 commit comments

Comments
 (0)