@@ -14,6 +14,7 @@ import {
1414 customLoopPlayAudioEventName ,
1515 customYoutubePlayEventName ,
1616} from '../lib/video' ;
17+ import { CardPicture , type Props as CardPictureProps } from './CardPicture' ;
1718import { useConfig } from './ConfigContext' ;
1819import type { PLAYER_STATES , PlayerStates } from './LoopVideoPlayer' ;
1920import { LoopVideoPlayer } from './LoopVideoPlayer' ;
@@ -43,7 +44,11 @@ type Props = {
4344 width : number ;
4445 height : number ;
4546 image : string ;
46- fallbackImageComponent : JSX . Element ;
47+ fallbackImage : CardPictureProps [ 'mainImage' ] ;
48+ fallbackImageSize : CardPictureProps [ 'imageSize' ] ;
49+ fallbackImageLoading : CardPictureProps [ 'loading' ] ;
50+ fallbackImageAlt : CardPictureProps [ 'alt' ] ;
51+ fallbackImageAspectRatio : CardPictureProps [ 'aspectRatio' ] ;
4752} ;
4853
4954export const LoopVideo = ( {
@@ -53,7 +58,11 @@ export const LoopVideo = ({
5358 width,
5459 height,
5560 image,
56- fallbackImageComponent,
61+ fallbackImage,
62+ fallbackImageSize,
63+ fallbackImageLoading,
64+ fallbackImageAlt,
65+ fallbackImageAspectRatio,
5766} : Props ) => {
5867 const adapted = useShouldAdapt ( ) ;
5968 const { renderingTarget } = useConfig ( ) ;
@@ -141,6 +150,16 @@ export const LoopVideo = ({
141150 }
142151 } ;
143152
153+ const FallbackImageComponent = (
154+ < CardPicture
155+ mainImage = { fallbackImage }
156+ imageSize = { fallbackImageSize }
157+ loading = { fallbackImageLoading }
158+ aspectRatio = { fallbackImageAspectRatio }
159+ alt = { fallbackImageAlt }
160+ />
161+ ) ;
162+
144163 /**
145164 * Setup.
146165 *
@@ -333,7 +352,9 @@ export const LoopVideo = ({
333352
334353 if ( renderingTarget !== 'Web' ) return null ;
335354
336- if ( adapted ) return fallbackImageComponent ;
355+ if ( adapted ) {
356+ return FallbackImageComponent ;
357+ }
337358
338359 const handlePlayPauseClick = ( event : React . SyntheticEvent ) => {
339360 event . preventDefault ( ) ;
@@ -433,7 +454,7 @@ export const LoopVideo = ({
433454 width = { width }
434455 height = { height }
435456 posterImage = { posterImage }
436- fallbackImageComponent = { fallbackImageComponent }
457+ FallbackImageComponent = { FallbackImageComponent }
437458 currentTime = { currentTime }
438459 setCurrentTime = { setCurrentTime }
439460 ref = { vidRef }
0 commit comments