This is a practical reference for track a media element's playback and buffering progress. Keep it nearby when you are writing a page, but do not worry about memorizing every entry at once.
What this reference covers
Track a media element's playback and buffering progress. The entries below summarize the most useful choices and what each one means.
| Value or item | What it means |
|---|---|
play | Playback requested |
playing | Playback running |
pause | Paused |
ended | Finished |
timeupdate | Playhead moved |
loadedmetadata | Metadata available |
error | Load failed |
waiting | Playback stalled |
See it in HTML
A small example shows how one of these ideas appears in a normal page:
<video id="lesson" controls src="lesson.mp4"></video>
<script>
document.getElementById("lesson").addEventListener("ended", () => {
console.log("Lesson completed");
});
</script>
How to use the reference
Begin by identifying what the page is trying to achieve. Then choose the entry that describes that job, instead of choosing a setting merely because it looks familiar.
Read the code from the outer element inward. Pay attention to attribute names, tag nesting, and any links between elements through IDs. A browser may accept some incorrect markup, but accepting it is not the same as using it correctly.
A useful check before publishing
Try changing one choice in the example while keeping the rest of the page the same. Inspect the result in your browser. For compatibility-sensitive features, test another browser; for accessibility-sensitive features, use keyboard navigation and an accessibility inspector.
Some entries describe browser hints rather than guarantees. User input still needs server-side validation, and event-based behavior needs JavaScript even if the HTML describes the control.
Recommended approach: Inline event handler attributes exist in HTML references, but addEventListener() in a separate JavaScript file is usually easier to maintain and works better with strict Content Security Policy settings.
Common Beginner Mistakes
- Treating every item in a reference list as interchangeable instead of choosing the one that matches the job.
- Copying reference markup without checking the element’s surrounding context or required attributes.
- Assuming one successful browser test proves the markup is accessible or universally supported.
Key Takeaways
- Track a media element's playback and buffering progress.
- Pick a setting for its meaning, then test the smallest working example.
- HTML references are most useful when combined with validation, browser inspection, and accessibility testing.