ProblemsVideo Autoplay Policies
02Hard

Video Autoplay Policies

JavaScript / Browser APIs

JavaScriptVideoAutoplayBrowser PoliciesReact

Context

`autoPlay` was removed from the MDX video component and replaced with a `useEffect` + `play()`. The attribute caused a race condition where the video's play state conflicted with the component's initialized control state.

The Concept

The `autoPlay` attribute is a hint browsers can silently ignore. Programmatic `play()` in a `useEffect` gives you the Promise rejection, precise timing control, and avoids the loading-phase race condition.

Task

Remove the `autoPlay` attribute and replace it with a `useEffect` that calls `videoRef.current.play()`, sets `isPlaying` to `true` on success, and catches any browser rejection.

component.jsx
Hints0/3 revealed