Skip to content

Commit 00f5fe7

Browse files
authored
Reorder promise returns and explicitly set the playerstate and autoplayFailure so that the play icon displays correctly (#14258)
1 parent e74bd40 commit 00f5fe7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

dotcom-rendering/src/components/LoopVideo.importable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ export const LoopVideo = ({
117117
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- In earlier versions of the HTML specification, play() didn't return a value
118118
if (startPlayPromise !== undefined) {
119119
await startPlayPromise
120+
.then(() => {
121+
// Autoplay succeeded
122+
setPlayerState('PLAYING');
123+
})
120124
.catch((error: Error) => {
121125
// Autoplay failed
122126
logAndReportError(src, error);
123127
setPosterImage(image);
124-
setShowPlayIcon(true);
125-
})
126-
.then(() => {
127-
// Autoplay succeeded
128-
setPlayerState('PLAYING');
128+
setPlayerState('PAUSED_BY_BROWSER');
129129
});
130130
}
131131
}, [src, image]);

0 commit comments

Comments
 (0)