File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -489,16 +489,20 @@ export const LoopVideo = ({
489489 const handleLoadedMetadata = ( ) => {
490490 if ( ! vidRef . current ) return ;
491491
492- console . log ( 'textTracks' , vidRef . current . textTracks ) ;
493-
494492 const track = vidRef . current . textTracks [ 0 ] ;
495493 if ( ! track ?. cues ) return ;
496-
497- console . log ( 'cues' , track . cues ) ;
494+ const pxFromBottom = 16 ;
495+ const videoHeight =
496+ vidRef . current . getBoundingClientRect ( ) . height ||
497+ vidRef . current . clientHeight ||
498+ height ;
499+ const percentFromTop =
500+ ( ( videoHeight - pxFromBottom ) / videoHeight ) * 100 ;
498501
499502 for ( const cue of Array . from ( track . cues ) ) {
500503 if ( cue instanceof VTTCue ) {
501- cue . line = - 2 ;
504+ cue . snapToLines = false ;
505+ cue . line = percentFromTop ;
502506 }
503507 }
504508 } ;
You can’t perform that action at this time.
0 commit comments