File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -875,6 +875,8 @@ export const Card = ({
875875 </ div >
876876 ) }
877877
878+ { /** Don't merge this! */ }
879+ < p > subtitleSize: { subtitleSize } </ p >
878880 < CardLayout
879881 cardBackgroundColour = { backgroundColour }
880882 mediaPositionOnDesktop = { mediaPositionOnDesktop }
@@ -960,7 +962,19 @@ export const Card = ({
960962 defer = { { until : 'visible' } }
961963 >
962964 < LoopVideo
963- sources = { media . mainMedia . sources }
965+ // sources={media.mainMedia.sources}
966+ sources = { [
967+ {
968+ // Test loop with subtitles
969+ src : 'https://uploads.guimcode.co.uk/2025/09/01/Loop__Japan_fireball--ace3fcf6-1378-41db-9d21-f3fc07072ab2-1.10.m3u8' ,
970+ // src: 'https://uploads.guim.co.uk/2025/08/20/Allaire+loop+--83f7d9ab-b1ff-439c-9631-8febd724829b-1.m3u8',
971+ mimeType : 'application/x-mpegURL' ,
972+ } ,
973+ {
974+ src : 'https://uploads.guim.co.uk/2025%2F06%2F20%2Ftesting+only%2C+please+ignore--3cb22b60-2c3f-48d6-8bce-38c956907cce-3.mp4' ,
975+ mimeType : 'video/mp4' ,
976+ } ,
977+ ] }
964978 atomId = { media . mainMedia . atomId }
965979 uniqueId = { uniqueId }
966980 height = { media . mainMedia . height }
Original file line number Diff line number Diff line change @@ -486,6 +486,23 @@ export const LoopVideo = ({
486486 return FallbackImageComponent ;
487487 }
488488
489+ const handleLoadedMetadata = ( ) => {
490+ if ( ! vidRef . current ) return ;
491+
492+ console . log ( 'textTracks' , vidRef . current . textTracks ) ;
493+
494+ const track = vidRef . current . textTracks [ 0 ] ;
495+ if ( ! track ?. cues ) return ;
496+
497+ console . log ( 'cues' , track . cues ) ;
498+
499+ for ( const cue of Array . from ( track . cues ) ) {
500+ if ( cue instanceof VTTCue ) {
501+ cue . line = - 2 ;
502+ }
503+ }
504+ } ;
505+
489506 const handleLoadedData = ( ) => {
490507 if ( vidRef . current ) {
491508 setHasAudio ( doesVideoHaveAudio ( vidRef . current ) ) ;
@@ -625,6 +642,7 @@ export const LoopVideo = ({
625642 isPlayable = { isPlayable }
626643 playerState = { playerState }
627644 isMuted = { isMuted }
645+ handleLoadedMetadata = { handleLoadedMetadata }
628646 handleLoadedData = { handleLoadedData }
629647 handleCanPlay = { handleCanPlay }
630648 handlePlayPauseClick = { handlePlayPauseClick }
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ type Props = {
106106 currentTime : number ;
107107 setCurrentTime : Dispatch < SetStateAction < number > > ;
108108 isMuted : boolean ;
109+ handleLoadedMetadata : ( event : SyntheticEvent ) => void ;
109110 handleLoadedData : ( event : SyntheticEvent ) => void ;
110111 handleCanPlay : ( event : SyntheticEvent ) => void ;
111112 handlePlayPauseClick : ( event : SyntheticEvent ) => void ;
@@ -140,6 +141,7 @@ export const LoopVideoPlayer = forwardRef(
140141 currentTime,
141142 setCurrentTime,
142143 isMuted,
144+ handleLoadedMetadata,
143145 handleLoadedData,
144146 handleCanPlay,
145147 handlePlayPauseClick,
@@ -177,6 +179,7 @@ export const LoopVideoPlayer = forwardRef(
177179 muted = { isMuted }
178180 playsInline = { true }
179181 poster = { posterImage }
182+ onLoadedMetadata = { handleLoadedMetadata }
180183 onLoadedData = { handleLoadedData }
181184 onCanPlay = { handleCanPlay }
182185 onCanPlayThrough = { handleCanPlay }
You can’t perform that action at this time.
0 commit comments