Before HTML5, to display video, audio, animation and other multimedia information on the Web, in addition to using third-party independent development of the player, the most used tool should be regarded as Flash, but they need to install various plug-in to your browser use, sometimes very slow. The emergence of HTML5 this situation has been changed. In HTML5 provides a standard interface for audio, multimedia players no longer need to install plug-ins, and only need a browser that supports HTML5 on it. This section describes both video and audio HTML5 newly added elements, which are used to process video and audio data. Currently more than Safari 3, Firefox 4 or more, Opera 10 or more, and Google Chrome 3.0 or more browsers implement the elements of these two media support. With audio elements, for example, as long as the specified URL address of the audio player to the src attribute of the element on it. Code as follows:
html file will open on the contains the above code in a browser, if the browser supports audio feature audio player appears, otherwise the page "Your browser does not support audio audio function." Effect 4:
FIG 4 Audio <audio> tag
The method of using the video and audio of the video element similar to the element simply set the length, width and other attributes can. Code as follows:
FIG Video 4.5 <video> tag
Each browser support for a variety of different media types and situations encoding format, you can specify a variety of playback formats and coding for the same media data source elements to ensure that browsers can select one of the supported players format for playback. Selection order for the browser to write the code in the order, it will be down from the judge himself whether to support the playback format, up to the election. For the case of each browser supports encoding format as shown in Table 3.
Table 3 browsers support the case for the encoding format
audio and video elements through the use of some common property, some of the features can be defined and extended, they have substantially the same properties. Two elements common attributes shown in Table 4.
Table 4 Common Property Description audio and video elements
In addition to the properties provided in Table 4, there are some properties, methods and events available, but requires a combination of JavaScript to achieve certain results. For example, the error property can handle errors; networkState used to read the current network state property; play media used to play method; a method using the load reload media player; to change the current playback position notified by the event timeupdate; binding JavaScript to display the current playback progress and so on.