Skip to content

Commit 6175452

Browse files
authored
Revert "Self styled subtitles (#14689)" (#14783)
This reverts commit 75ad4a8.
1 parent ec67385 commit 6175452

File tree

5 files changed

+3
-208
lines changed

5 files changed

+3
-208
lines changed

dotcom-rendering/src/components/LoopVideo.importable.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { getZIndex } from '../lib/getZIndex';
1212
import { generateImageURL } from '../lib/image';
1313
import { useIsInView } from '../lib/useIsInView';
1414
import { useShouldAdapt } from '../lib/useShouldAdapt';
15-
import { useSubtitles } from '../lib/useSubtitles';
1615
import type { CustomPlayEventDetail, Source } from '../lib/video';
1716
import {
1817
customLoopPlayAudioEventName,
@@ -173,12 +172,6 @@ export const LoopVideo = ({
173172
threshold: VISIBILITY_THRESHOLD,
174173
});
175174

176-
const activeCue = useSubtitles({
177-
video: vidRef.current,
178-
playerState,
179-
currentTime,
180-
});
181-
182175
const playVideo = useCallback(async () => {
183176
const video = vidRef.current;
184177
if (!video) return;
@@ -665,7 +658,6 @@ export const LoopVideo = ({
665658
showPlayIcon={showPlayIcon}
666659
subtitleSource={subtitleSource}
667660
subtitleSize={subtitleSize}
668-
activeCue={activeCue}
669661
/>
670662
</figure>
671663
);

dotcom-rendering/src/components/LoopVideoPlayer.tsx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ import type {
1313
SyntheticEvent,
1414
} from 'react';
1515
import { forwardRef } from 'react';
16-
import type { ActiveCue } from '../lib/useSubtitles';
1716
import type { Source } from '../lib/video';
1817
import { palette } from '../palette';
1918
import { narrowPlayIconWidth, PlayIcon } from './Card/components/PlayIcon';
2019
import { LoopVideoProgressBar } from './LoopVideoProgressBar';
21-
import { SubtitleOverlay } from './SubtitleOverlay';
2220

2321
export type SubtitleSize = 'small' | 'medium' | 'large';
2422

@@ -37,10 +35,8 @@ const videoStyles = (
3735
object-fit: cover;
3836
3937
::cue {
40-
/* Hide the cue by default as we prefer custom overlay */
41-
visibility: hidden;
42-
4338
color: ${palette('--loop-video-subtitle-text')};
39+
4440
${subtitleSize === 'small' && textSans15};
4541
${subtitleSize === 'medium' && textSans17};
4642
${subtitleSize === 'large' && textSans20};
@@ -123,8 +119,6 @@ type Props = {
123119
showPlayIcon: boolean;
124120
subtitleSource?: string;
125121
subtitleSize: SubtitleSize;
126-
/* used in custom subtitle overlays */
127-
activeCue?: ActiveCue | null;
128122
};
129123

130124
/**
@@ -164,11 +158,11 @@ export const LoopVideoPlayer = forwardRef(
164158
showPlayIcon,
165159
subtitleSource,
166160
subtitleSize,
167-
activeCue,
168161
}: Props,
169162
ref: React.ForwardedRef<HTMLVideoElement>,
170163
) => {
171164
const loopVideoId = `loop-video-${uniqueId}`;
165+
172166
return (
173167
<>
174168
{/* eslint-disable-next-line jsx-a11y/media-has-caption -- Captions will be considered later. */}
@@ -219,23 +213,13 @@ export const LoopVideoPlayer = forwardRef(
219213
))}
220214
{subtitleSource !== undefined && (
221215
<track
222-
// Don't use default - it forces native rendering on iOS
223-
default={false}
216+
default={true}
224217
kind="subtitles"
225218
src={subtitleSource}
226-
// Add label to ensure iOS recognizes it
227-
label="English"
228-
srcLang="en"
229219
/>
230220
)}
231221
{FallbackImageComponent}
232222
</video>
233-
{!!activeCue?.text && (
234-
<SubtitleOverlay
235-
text={activeCue.text}
236-
subtitleSize={subtitleSize}
237-
/>
238-
)}
239223
{ref && 'current' in ref && ref.current && isPlayable && (
240224
<>
241225
{/* Play icon */}

dotcom-rendering/src/components/SubtitleOverlay.tsx

Lines changed: 0 additions & 70 deletions
This file was deleted.

dotcom-rendering/src/lib/useSubtitles.ts

Lines changed: 0 additions & 107 deletions
This file was deleted.

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7335,10 +7335,6 @@ const paletteColours = {
73357335
light: () => sourcePalette.neutral[86],
73367336
dark: () => sourcePalette.neutral[86],
73377337
},
7338-
'--loop-video-subtitle-background': {
7339-
light: () => transparentColour(sourcePalette.neutral[7], 0.7),
7340-
dark: () => transparentColour(sourcePalette.neutral[7], 0.7),
7341-
},
73427338
'--loop-video-subtitle-text': {
73437339
light: () => sourcePalette.neutral[100],
73447340
dark: () => sourcePalette.neutral[100],

0 commit comments

Comments
 (0)