HTML 5 video and audio properties

Source: Internet
Author: User
Tags error status code ranges

src Properties, and AutoPlay PropertiesThe SRC attribute is used to specify the URL address of the media data. The AutoPlay property is used to specify whether the media plays automatically after the page is loaded, using the following method: <video src= "Sample.mov" autoplay= "AutoPlay" ></video> Perload PropertiesThis property is used to specify whether video or audio data is preloaded. If preloading is used, the browser will pre-buffer video or audio data, which can speed up playback because the data is pre-buffered when playing. There are three optional values for this property, "None", "metadata", and "auto", with the default value "Auto". A value of none indicates no preload; metadata indicates that only the media's metadata (media bytes, first frame, playlist, duration, and so on) is preloaded. Auto indicates that all video or audio is preloaded. PerloadThe properties are used as shown below. <video src= "Sample.mov" preload= "Auto" ></video> Poster ( Video element Unique properties) and Loop Properties Poster ( Video element Exclusive property)When the video is not available, you can use this element to show the user an alternate picture. When the video is not available, it is best to use the Poster property to avoid a blank space in the area where the video is displayed. This property is used as follows: <video src= "Sample.mov" psoter= "cannotuse.jpg" ></video> Loop PropertiesLets you specify whether to loop video or audio, using the following method: <video src= "Sample.mov" autoplay= "AutoPlay" loop= "loop" ></video>L Controls Properties, Wdith Properties, and Height Property (the latter two Video element Exclusive property)Controls PropertiesSpecifies whether to add a control bar for playback with the browser's own video or audio. The control bar has buttons for playing, pausing, and so on. Here's how to use it: <video src= "Sample.mov" controls= "Controls" ></video>width Properties and Height Properties ( Video element Exclusive property)Lets you specify the width and height of the video in pixels, using the following method: <video src= "Sample.mov" width= " $" height= "></video" >L Error PropertiesIn the process of reading, using media data, the property is null under normal circumstances, but whenever an error occurs, the property returns an Mediaerror object whose Code property returns the corresponding error status code, with possible values such as: media_err_ Aborted (value 1): The downloading process of media data is terminated due to the user's operational reasons. Media_err_network (value 2): Confirms that the media resource is available, but a network error occurred while downloading, and the download process for the media data was terminated. Media_err_decode (value 3): Confirms that the media resource is available, but an error occurred while decoding. media_err_src_not_supported (value 4): Media Resource Unavailable Media format is not supported. Note: Error property is a read-only property. L networkstate PropertiesThis property reads the status of the current network during media data load, and its values include: Network_empty (value 0): The element is in its initial state. Network_idle (value 1): The browser has chosen what encoding format to use to play the media, but the network connection has not been established. network_loading (value 2): Media data loading. Network_no_source (value 3): There is no supported encoding format and does not perform the load. Note: networkstate property is a read-only propertyL currentsrc Properties, Buffered Properties• You can use the Currentsrc property to read the URL address of media data in playback, which is a read-only property. The buffered property returns an object that implements the Timeranges interface to confirm that the browser has cached media data. timeranges The purpose of the object:The Timeranges object represents a time range, in most cases, the time range represented by the object is a single range starting with "0", but if the browser issues a range rquest request, the time range represented by the Timeranges object is multiple time ranges. timeranges properties of the object:The object has a length property, which indicates how many time ranges exist, and in most cases the time range is "1"; when there is no time span, the value is "0". timeranges There are two methods for objects:Start (index) and end (index), in most cases, set the index to "0". When using the Element.buffered statement to implement the Timeranges interface, start (0) indicates the time from which the media data is cached in the current buffer, and end (0) indicates the end time within the current buffer. Note: Buffered property is a read-only propertyL readyState PropertiesThis property returns the ready state of the media's current playback position, with values such as: have_nothing (value 0): No information has been obtained from the media, and there is no playable data for the current playback position. Have_metadata (value 1): Sufficient media data has been obtained, but there is no valid media data for the current playback location (that is, the obtained media data is invalid and cannot be played). Have_current_data (value 2): The current playback position already has data to play, but did not get the data that can move the player forward. When the media is video, it means that the current frame's data has been obtained, but has not yet obtained the data to the next frame, or the current frame is already the last frame played. Have_future_data (value 3): The current playback position already has the data to play, but also obtains the data which lets the player advance. When the media is video, meaning that the current frame of the data has been acquired, but also to obtain the next frame of data, the current frame is playing the last frame ReadyState property cannot be have_future_data. Have_enough_data (value 4): The current playback position has data can be played, but also to get the player to advance the data, and the browser confirms that the media data at a certain speed to load, you can ensure that there is enough subsequent data to play. Note: readyState property is a read-only property. L seeking Properties, and seekable PropertiesThe seeking property returns a Boolean value that indicates whether the browser is requesting data for a particular playback location, and True indicates that the browser is requesting data, false indicating that the browser has stopped the request. The seekable property returns a Timeranges object that represents the time range of the data requested. When the media is video, the start time is the time that the first frame of the video data is requested, and the end time is the time of the last frame of the request to the video data. Note: Both of these properties are read-only properties. L currenttime Properties, StartTime Properties, and Duration PropertiesThe CurrentTime property is used to read the current playback position of the media, or you can modify the current playback position by modifying the CurrentTime property. If no media data is available at the modified location, the Invalid_state_err exception is thrown, and if the modified location exceeds the range of data that the browser can request in a single request, the Index_size_err exception is thrown. The StartTime property is used to read the start time of the media playback, typically "0". The Duration property to read the total playback time of the media file. L played Properties, paused Properties, and ended PropertiesThe played property returns a Timeranges object from which the time period of the played portion of the media file can be read. The start time is the start time of the played part, and the end time is the end time of the part that has been played. The paused property returns a Boolean value that indicates whether playback is paused, true indicates that the media is paused, and false indicates that the media is playing. The ended property returns a Boolean value that indicates whether playback is complete, and true indicates that the media has finished playing, and false indicates that it has not finished playing. Note: All three are read-only properties. L defaultplaybackrate Properties, and playbackrate PropertiesThe Defaultplaybackrate property is used to read or modify the media default playback rate. The Playbackrate property is used to read or modify the current playback rate of the media. L Volume Properties, and muted PropertiesThe volume property is used to read or modify the playback volume of the media, ranging from "0" to "1", "0" to mute, and "1" to the maximum volume. The muted property is used to read or modify the mute state of the media, which is a Boolean value, and True indicates that it is muted and false indicates that it is in a non-muted state.  

HTML 5 video and audio properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.