Skip to content

Commit fe75245

Browse files
committed
looping video: use fallback image for replacement video
1 parent b27bedc commit fe75245

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

dotcom-rendering/src/model/enhanceCards.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,23 @@ const getLargestImageUrl = (images?: Image[]) => {
167167
};
168168

169169
/**
170-
* If we have a replacement video, we should use the largest available trail image from the media atom.
171-
* For all other videos, we should use the card's trail image where it is available and fall back to the media trail image.
172-
* */
170+
* If we have a replacement video, we should prioritise the largest available trail image from the media atom.
171+
* For all other videos, we should prioritise the card's trail image.
172+
*/
173173
const decideMediaAtomImage = (
174174
videoReplace: boolean,
175175
mediaAtom: FEMediaAtom,
176176
cardTrailImage?: string,
177177
) => {
178+
const largestMediaAtomImage = getLargestImageUrl(
179+
mediaAtom.trailImage?.allImages,
180+
);
181+
178182
if (videoReplace) {
179-
return getLargestImageUrl(mediaAtom.trailImage?.allImages);
183+
return largestMediaAtomImage ?? cardTrailImage;
180184
}
181-
return (
182-
cardTrailImage ?? getLargestImageUrl(mediaAtom.trailImage?.allImages)
183-
);
185+
186+
return cardTrailImage ?? largestMediaAtomImage;
184187
};
185188

186189
/**

0 commit comments

Comments
 (0)