New media player elements IT Band of Brothers HTML5 tutorial multimedia applications

4d7482427b564e75b752e1f9e4eecbf4.jpg

 

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:

0aa3203e21b243208bd82864a2ba94ba.jpg

 

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:

d35df90ac3f64005890ef173b2fbcc8d.jpg

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:

7b8fcdb80117473a83fd8f02d5e5323c.jpg

8d9b5a98535b44bba5d364b157414bdd.jpg

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

 

878f747d53a44893865ca7d7beedc58e.png

 

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

 

351555546be74015a2542988289e8cc8.png

 

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.

Guess you like

Origin www.cnblogs.com/itxdl/p/11647433.html