Skip to content

Commit 05e4174

Browse files
fix(Video): set muted attribute in HTML of DefaultVideo (#1289)
1 parent 3115ece commit 05e4174

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/DefaultVideo/DefaultVideo.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ export const DefaultVideo = React.forwardRef<DefaultVideoRefType, DefaultVideoPr
6161
};
6262
}, [videoRef, onVideoEnd]);
6363

64+
// to guarantee setting a muted attribute in HTML. https://github.com/facebook/react/issues/10389
65+
React.useEffect(() => {
66+
const videoElement = videoRef.current;
67+
68+
if (videoElement && initiallyMuted) {
69+
videoElement.defaultMuted = true;
70+
}
71+
}, [videoRef, initiallyMuted]);
72+
6473
const onPlayToggle = React.useCallback(() => {
6574
setIsPaused((value) => {
6675
if (value) {

0 commit comments

Comments
 (0)