跳至侧栏

HTML5-Audio_Video-属性与事件

1.只读属性
duration: The duration of the full media clip, in seconds. If the full duration is not known, NaN is returned.
paused: Returns true if the media clip is currently paused. Defaults to true if the clip has not started playing.
ended: Returns true if the media clip has finished playing.
startTime: Returns the earliest possible value for playback start time. This will usually be 0.0 unless the media clip is streamed and earlier content has left the buffer.
error: An error code, if an error has occurred.
currentSrc: Returns the string representing the file that is currently being displayed or loaded. This will match the source element selected by the browser.
preload:有auto,none,metadata三个值,无默认值。
src:视频或音频的来源。
readyState:值的范围是[0,4]中五个整数,分别表示不同的可用状态。例如值为1表明元数据可用,值为4的意义同canplaythrough。
buffered:已缓冲的视频或音频时间范围。

2.可读可写属性
autoplay: Sets the media clip to play upon creation or query whether it is set to autoplay.可在<audio>标记中设置。
loop: Returns true if the clip will restart upon ending or sets the clip to loop (or not loop). 可在<audio>标记中设置。
currentTime: Returns the current time in seconds that has elapsed since the beginning of the playback. Sets currentTime to seek to a specific position in the clip playback.
controls: Shows or hides the user controls, or queries whether they are currently visible. 可在<audio>标记中设置。
volume: Sets the audio volume to a relative value between 0.0 and 1.0, or queries the value of the same.
muted: Mutes or unmutes the audio, or determines the current mute state.
autobuffer: Tells the player whether or not to attempt to load the media file before playback is initiated. If the media is set for auto- playback,this attribute is ignored.可在<audio>标记中设置。
playbackRate:控制播放速度。

3.video专有属性
poster: The URL of an image file used to represent the video content before it has loaded. Think “movie poster.” This attribute can be read or altered to change the poster.
width, height: Read or set the visual display size. This may cause centering, letterboxing, or pillaring if the set width does not match the size of the video itself.
videoWidth, videoHeight: Return the intrinsic or natural width and height of the video. They cannot be set.

4.事件
canplay, canplaythrough, play, pause, volumechange, ended, timeupdate,error, loadeddata, loadedmetadata, playing, seeking, seeked.

 

posted @ 2012-12-21 16:32  JiayangShen  阅读(1865)  评论(0编辑  收藏  举报
Top
推荐
收藏
关注
评论