Java Reference
In-Depth Information
Figure 14.4. Browser video controls
The audio or video element can be referenced by a variable using one of the
document
methods we saw in
Chapter 6
:
video = document.getElementsByTagName("video")[0];
Audio and video elements have a number of properties and methods to control the playback
of the clip.
The
play()
method will start the clip playing from its current position:
video.play();
The
pause()
method will pause the clip at its current position:
video.pause();
The
volume
property is a number that can be used to set the audio volume:
video.volume = 90;
The
muted
property is a Boolean value that can be used to mute the audio:

