Contents

HTMLMediaElement

An abstract superclass for media classes that display audio or video in webpages. This class defines common properties and methods inherited by the Htmlaudioelement and Htmlvideoelement classes representing the HTML audio and video elements.

Declaration

interface HTMLMediaElement

Overview

Handling Events

The different types of media events that can occur are described in Table 1.

Event

Description

abort

Sent when the browser stops fetching the media data before the media resource was completely downloaded.

canplay

Sent when the browser can resume playback of the media data, but estimates that if playback is started now, the media resource could not be rendered at the current playback rate up to its end without having to stop for further buffering of content.

canplaythrough

Sent when the browser estimates that if playback is started now, the media resource could be rendered at the current playback rate all the way to its end without having to stop for further buffering.

durationchange

Sent when the 1630916 Duration property changes.

emptied

Sent when the media element network state changes to the 1629429 Network_empty state.

ended

Sent when playback has stopped at the end of the media resource and the 1630452 Ended property is set to true.

error

Sent when an error occurs while fetching the media data. Use the 1630743 Error property to get the current error.

loadeddata

Sent when the browser can render the media data at the current playback position for the first time.

loadedmetadata

Sent when the browser knows the duration and dimensions of the media resource.

loadstart

Sent when the browser begins loading the media data.

pause

Sent when playback pauses after the 1633571 Pause method returns.

play

Sent when playback starts after the 1630114 Play method returns.

playing

Sent when playback starts.

progress

Sent when the browser is fetching the media data.

ratechange

Sent when either the 1631650 Defaultplaybackrate or the 1629746 Playbackrate property changes.

seeked

Sent when the 1634314 Seeking property is set to false

seeking

Sent when the 1634314 Seeking property is set to true and there is time to send this event.

stalled

Sent when the browser is fetching media data but it has stopped arriving.

suspend

Sent when the browser suspends loading the media data and does not have the entire media resource downloaded.

timeupdate

Sent when the 1631307 Currenttime property changes as part of normal playback or because of some other condition.

volumechange

Sent when either the 1631549 Volume property or the 1630580 Muted property changes.

waiting

Sent when the browser stops playback because it is waiting for the next frame.

Topics

Getting and Setting Properties

Getting State

Controlling Playback

Constants

Instance Properties

Instance Methods