PROWAREtech

articles » current » javascript » tutorial » page-20

JavaScript: Tutorial - A Guide to JavaScript - Page 20

Media Elements (AUDIO, VIDEO).

Media Elements

HTML5 introduces two media-related elements to enable cross-browser audio and video embedding into a browser baseline by using the new elements <audio> and <video>.

PROPERTY NAMEDATA TYPEDESCRIPTION
autoplayBooleanGets or sets the autoplay flag.
bufferedTimeRangesAn object indicating the buffered time ranges that have already been downloaded.
bufferedBytesByteRangesAn object indicating the buff ered byte ranges that have already been downloaded.
bufferingRateIntegerThe average number of bits per second received from the download.
bufferingThrottledBooleanIndicates if the buff ering has been throttled by the browser.
controlsBooleanGets or sets the controls attribute, which displays or hides the browser's built-in controls.
currentLoopIntegerThe number of loops that the media has played.
currentSrcStringThe URI for the currently playing media.
currentTimeFloatThe number of seconds that have been played.
defaultPlaybackRateFloatGets or sets the default playback rate. By default, this is 1.0 seconds.
durationFloatThe total number of seconds for the media.
endedBooleanIndicates if the media has completely played.
loopBooleanGets or sets whether the media should loop back to the start when finished.
mutedBooleanGets or sets if the media is muted.
networkStateIntegerIndicates the current state of the network connection for the media: 0 for empty, 1 for loading, 2 for loading meta data, 3 for loaded fi rst frame, and 4 for loaded.
pausedBooleanIndicates if the player is paused.
playbackRateFloatGets or sets the current playback rate. This may be affected by the user causing the media to play faster or slower, unlike defaultPlaybackRate, which remains unchanged unless the developer changes it.
playedTimeRangesThe range of times that have been played thus far.
readyStateIntegerIndicates if the media is ready to be played. Values are 0 if the data is unavailable, 1 if the current frame can be displayed, 2 if the media can begin playing, and 3 if the media can play from beginning to end.
seekableTimeRangesThe ranges of times that are available for seeking.
seekingBooleanIndicates that the player is moving to a new position in the media file.
srcStringThe media file source. This can be rewritten at any time.
startFloatGets or sets the location in the media file, in seconds, where playing should begin.
totalBytesIntegerThe total number of bytes needed for the resource (if known).
videoHeightIntegerReturns the height of the video (not necessarily of the element). Only for <video>.
videoWidthIntegerReturns the width of the video (not necessarily of the element). Only for <video>.
volumeFloatGets or sets the current volume as a value between 0.0 and 1.0.

 

EVENT NAMEFIRES WHEN
abortDownloading has been aborted.
canplayPlayback can begin; readyState is 2.
canplaythroughPlayback can proceed and should be uninterrupted; readyState is 3.
canshowcurrentframeThe current frame has been downloaded; readyState is 1.
dataunavailablePlayback can't happen because there's no data; readyState is 0.
durationchangeThe duration property value has changed.
emptiedThe network connection has been closed.
emptyAn error occurs that prevents the media download.
endedThe media has played completely through and is stopped.
errorA network error occurred during download.
loadAll of the media has been loaded. This event is considered deprecated; use canplaythrough instead.
loadeddataThe first frame for the media has been loaded.
loadedmetadataThe meta data for the media has been loaded.
loadstartDownloading has begun.
pausePlayback has been paused.
playThe media has been requested to start playing.
playingThe media has actually started playing.
progressDownloading is in progress.
ratechangeThe speed at which the media is playing has changed.
seekedSeeking has ended.
seekingPlayback is being moved to a new position.
stalledThe browser is trying to download, but no data is being received.
timeupdateThe currentTime is updated in an irregular or unexpected way.
volumechangeThe volume property value or muted property value has changed.
waitingPlayback is paused to download more data.
<<<[Page 20 of 22]>>>

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE