The use of new tags audio and video in h5

灭绝师太
Release: 2021-10-27 19:15:46
Original
3932 people have browsed it

If you are asked to add audio resources to the web page, how will you implement it?

Before the emergence of h5, we can use the iframe element to insert video resources into our web pages. The code is implemented as follows:

    Document 
Copy after login

The effect is as follows :

The use of new tags audio and video in h5

In addition, we can also use Html5 audio and video tags to introduce audio media resources into our web pages to increase the richness of the web pages Spend.

The

    h5 audio标签的使用 
Copy after login

The effect is as follows (chrome browser): Adding the controls attribute to the audio tag can display controls to the user, such as the play button; the loop attribute means that playback starts again whenever the audio ends.

The use of new tags audio and video in h5

The audio tag has different effects under different browsers:

The use of new tags audio and video in h5

##

Many trendy websites offer videos,Until now, there was still no standard for displaying videos on web pages. Today, most videos are displayed through plug-ins such as Flash. However, not all browsers have the same plugins.

HTML5 specifies a standard way to include video through the video element. And the video element supports global attributes (such as class, id, title, style, etc.) and event attributes (such as onresize, onredo, etc.) in HTML.

    Document 
Copy after login

The use of new tags audio and video in h5

##video Attribute


You can also set the video window size

Copy after login

Switch playback Address (commonly used to switch between ultra-clear and high-definition smooth, different video addresses of different quality)

 
Copy after login

Switching alternative addresses, multiple source elements can be embedded in the video tag as playback addresses Backup switching, when the first video fails to load, the next video will be automatically loaded.


 
Copy after login

##

The above is the detailed content of The use of new tags audio and video in h5. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!