File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -365,6 +365,12 @@ export const LoopVideo = ({
365
365
return FallbackImageComponent ;
366
366
}
367
367
368
+ const handleCanPlay = ( ) => {
369
+ if ( ! isPlayable ) {
370
+ setIsPlayable ( true ) ;
371
+ }
372
+ } ;
373
+
368
374
const handlePlayPauseClick = ( event : React . SyntheticEvent ) => {
369
375
event . preventDefault ( ) ;
370
376
playPauseVideo ( ) ;
@@ -466,7 +472,7 @@ export const LoopVideo = ({
466
472
const AudioIcon = isMuted ? SvgAudioMute : SvgAudio ;
467
473
468
474
return (
469
- < div
475
+ < figure
470
476
ref = { setNode }
471
477
css = { videoContainerStyles }
472
478
className = "loop-video-container"
@@ -484,9 +490,9 @@ export const LoopVideo = ({
484
490
setCurrentTime = { setCurrentTime }
485
491
ref = { vidRef }
486
492
isPlayable = { isPlayable }
487
- setIsPlayable = { setIsPlayable }
488
493
playerState = { playerState }
489
494
isMuted = { isMuted }
495
+ handleCanPlay = { handleCanPlay }
490
496
handlePlayPauseClick = { handlePlayPauseClick }
491
497
handleAudioClick = { handleAudioClick }
492
498
handleKeyDown = { handleKeyDown }
@@ -496,6 +502,6 @@ export const LoopVideo = ({
496
502
preloadPartialData = { preloadPartialData }
497
503
showPlayIcon = { showPlayIcon }
498
504
/>
499
- </ div >
505
+ </ figure >
500
506
) ;
501
507
} ;
Original file line number Diff line number Diff line change @@ -81,11 +81,11 @@ type Props = {
81
81
height : number ;
82
82
FallbackImageComponent : ReactElement ;
83
83
isPlayable : boolean ;
84
- setIsPlayable : Dispatch < SetStateAction < boolean > > ;
85
84
playerState : PlayerStates ;
86
85
currentTime : number ;
87
86
setCurrentTime : Dispatch < SetStateAction < number > > ;
88
87
isMuted : boolean ;
88
+ handleCanPlay : ( event : SyntheticEvent ) => void ;
89
89
handlePlayPauseClick : ( event : SyntheticEvent ) => void ;
90
90
handleAudioClick : ( event : SyntheticEvent ) => void ;
91
91
handleKeyDown : ( event : React . KeyboardEvent < HTMLVideoElement > ) => void ;
@@ -112,11 +112,11 @@ export const LoopVideoPlayer = forwardRef(
112
112
FallbackImageComponent,
113
113
posterImage,
114
114
isPlayable,
115
- setIsPlayable,
116
115
playerState,
117
116
currentTime,
118
117
setCurrentTime,
119
118
isMuted,
119
+ handleCanPlay,
120
120
handlePlayPauseClick,
121
121
handleAudioClick,
122
122
handleKeyDown,
@@ -149,9 +149,8 @@ export const LoopVideoPlayer = forwardRef(
149
149
muted = { isMuted }
150
150
playsInline = { true }
151
151
poster = { posterImage }
152
- onCanPlay = { ( ) => {
153
- setIsPlayable ( true ) ;
154
- } }
152
+ onCanPlay = { handleCanPlay }
153
+ onCanPlayThrough = { handleCanPlay }
155
154
onTimeUpdate = { ( ) => {
156
155
if (
157
156
ref &&
You can’t perform that action at this time.
0 commit comments