@@ -3,15 +3,11 @@ import { log } from '@guardian/libs';
3
3
import { space } from '@guardian/source/foundations' ;
4
4
import { SvgAudio , SvgAudioMute } from '@guardian/source/react-components' ;
5
5
import { useEffect , useRef , useState } from 'react' ;
6
- import type { FEAspectRatio } from '../frontend/feFront' ;
7
6
import { getZIndex } from '../lib/getZIndex' ;
8
7
import { useIsInView } from '../lib/useIsInView' ;
9
8
import { useShouldAdapt } from '../lib/useShouldAdapt' ;
10
9
import { palette } from '../palette' ;
11
- import type { ImageSizeType } from './Card/components/ImageWrapper' ;
12
10
import { narrowPlayIconWidth , PlayIcon } from './Card/components/PlayIcon' ;
13
- import type { Loading } from './CardPicture' ;
14
- import { CardPicture } from './CardPicture' ;
15
11
import { useConfig } from './ConfigContext' ;
16
12
import { LoopVideoProgressBar } from './LoopVideoProgressBar' ;
17
13
@@ -49,33 +45,22 @@ const audioButtonStyles = css`
49
45
cursor : pointer;
50
46
` ;
51
47
52
- type ImageProps = {
53
- posterImage : string ;
54
- imageSize : ImageSizeType ;
55
- imageLoading : Loading ;
56
- altText ?: string ;
57
- aspectRatio ?: FEAspectRatio ;
58
- } ;
59
-
60
- type Props = ImageProps & {
48
+ type Props = {
61
49
src : string ;
62
50
videoId ?: string ;
63
51
width ?: number ;
64
52
height ?: number ;
65
53
hasAudio ?: boolean ;
54
+ fallbackImage : JSX . Element ;
66
55
} ;
67
56
68
57
export const LoopVideo = ( {
69
58
src,
70
59
videoId,
71
- posterImage,
72
- imageSize,
73
- imageLoading,
74
- altText,
75
- aspectRatio,
76
60
width = 600 ,
77
61
height = 360 ,
78
62
hasAudio = true ,
63
+ fallbackImage,
79
64
} : Props ) => {
80
65
const adapted = useShouldAdapt ( ) ;
81
66
const { renderingTarget } = useConfig ( ) ;
@@ -132,15 +117,7 @@ export const LoopVideo = ({
132
117
if ( renderingTarget !== 'Web' ) return null ;
133
118
134
119
if ( adapted ) {
135
- return (
136
- < CardPicture
137
- mainImage = { posterImage }
138
- imageSize = { imageSize }
139
- alt = { altText }
140
- loading = { imageLoading }
141
- aspectRatio = { aspectRatio }
142
- />
143
- ) ;
120
+ return fallbackImage ;
144
121
}
145
122
146
123
const handleClick = ( event : React . SyntheticEvent ) => {
@@ -226,7 +203,6 @@ export const LoopVideo = ({
226
203
loop = { true }
227
204
muted = { isMuted }
228
205
playsInline = { true }
229
- poster = { posterImage }
230
206
height = { height }
231
207
width = { width }
232
208
onPlaying = { ( ) => {
@@ -241,13 +217,7 @@ export const LoopVideo = ({
241
217
{ /* Ensure webm source is provided */ }
242
218
{ /* <source src={webmSrc} type="video/webm"> */ }
243
219
< source src = { src } type = "video/mp4" />
244
- < CardPicture
245
- mainImage = { posterImage }
246
- imageSize = { imageSize }
247
- alt = { altText }
248
- loading = { imageLoading }
249
- aspectRatio = { aspectRatio }
250
- />
220
+ { fallbackImage }
251
221
</ video >
252
222
{ vidRef . current && (
253
223
< >
0 commit comments