HTML and CSS Reference
In-Depth Information
n Note To test the Flash or Silverlight fallback scheme, you need a browser version that doesn't support HTML5
<audio> and <video> elements.
Programming with the Audio and Video APIs
So far, you've been using static <audio> and <video> elements to play audio and video files. HTML5 also
provides a programmatic way to play and control media files using JavaScript. To give you a glimpse of
what you can configure, Table 3-3 shows a list of the properties, methods, and events of the <audio> and
<video> DOM elements that you have at your disposal. Note that Table 3-3 lists only the commonly used
members of <audio> and <video> .
n Note You can browse all the available members of the <audio> and <video> elements at www.w3schools.
com . This web site also provides a good reference for the other HTML5 tags, properties, methods, and events.
Table 3-3. Properties, Methods, and Events of the <audio> and <video> DOM Elements
Property /
Method / Event
Member
Description
canPlayType()
Method
The canPlayType() method returns true/false depending on whether a
particular MIME type can be played by the <audio> or <video> element.
currentTime
Property
The currentTime property indicates the current time instance of a
media file in seconds.
duration
Property
The duration attribute returns duration of the media file being played
in milliseconds. This property returns correct value only if the
metadata of the file is available at the time of reading the property.
ended
Event
The ended event is raised when the media file is played completely.
pause
Event
The pause event is raised when a media file is paused.
pause()
Method
The pause() method pauses a media file being played.
play
Event
The play event is raised when a media file is played.
play()
The play() method plays a media file specified by the src property.
Method
playbackRate
Property
The playbackRate property governs the speed at which a media file is
played. Default is 1 which means normal speed. Value of 2 means twice
the normal speed and so on.
playing
Event
The playing event is raised when the media file is ready to play.
src
The src property indicates a URL of the media file to be played.
Property
timeupdate
Event
The timeupdate event is raised when the current playback position is
changed.
volume
Property
The volume property indicates the volume level of the audio/video
player. Possible values are between 0 and 1, 1 being maximum volume
and 0 being mute.
volumechange
Event
The volumechange event is raised when the volume of a media file
being played is changed.
 
Search WWH ::




Custom Search