HTML5 Video
Many sites use videos. HTML5 provides a standard for displaying videos.
Videos on Web Sites
Until now, there was 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.
Video on the Web site
Until now, it still does not exist A standard designed to display video 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.
HTML5 (Video) - How it works
To display a video in HTML5, all you need is:
Example
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">您的浏览器不支持Video标签。</video> to control the video.
At the same time, the
element element also provides width and height AttributesControl the size of the video. If the height and width are set, the required video space will be reserved when the page is loaded. . If these properties are not set and the browser does not know the size of the video, the browser will not be able to reserve a specific space when loading, and the page will change based on the size of the original video.
The content inserted between the and tags is provided for display by browsers that do not support the video element.
The element supports multiple elements. The element can link different video files. The browser will use the first format it recognizes:
Video formats and browser support
Currently, the element supports three video formats: MP4, WebM, and Ogg :
MP4 = MPEG 4 file with H.264 video encoding and AAC Audio encoding
WebM = with VP8 WebM file with video encoding and Vorbis audio encoding
Ogg = Ogg file with Theora video encoding and Vorbis audio encoding
Video format
HTML5 - Control using the DOM
HTML5 and elements also have methods, properties and events .
Methods, properties, and events of the and elements can be controlled using JavaScript .
Methods include play, pause, and load wait. The properties (such as duration, volume, etc.) can be read or set. The DOM events can notify you that, for example, the element has started playing, has been paused, has been stopped, etc.
The simple method in the example shows us how to use the element, read and set attributes, and how to call methods.
HTML5 Video Tag
[Related recommendations]
1. html/css free video tutorial
2. Brief description of the parameters and attributes of the tag
3. Analyze the reason why the MP4 video in the video tag in the H5 web page cannot be played
4. Teach you how to use HTML5 audio and video
5. Teach you how to enhance the compatibility of video tags in H5 in browsers sex
The above is the detailed content of Detailed explanation of HTML5 standards for video display. For more information, please follow other related articles on the PHP Chinese website!
Statement: 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