亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

HTML5 Video(video)

Many sites use videos. HTML5 provides a standard for displaying videos.

Videos on Web Sites

Until now, there has been 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.


Browser support

8.jpg


##Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the <video> element.

Note: Internet Explorer 8 or earlier IE versions The <video> element is not supported.


HTML5 (Video) - How it works

To display video in HTML5, all you need is :

<!DOCTYPE html>
<html>
<head> 
    <meta charset="UTF-8">
    <title>php中文網(wǎng)(php.cn)</title> 
</head>
<body>
<video width="320" height="240" controls>
    <source src="movie.mp4" type="video/mp4">
    <source src="movie.ogg" type="video/ogg">
    您的瀏覽器不支持 HTML5 video 標(biāo)簽。
</video>
</body>
</html>

Run and try it


The<video> element provides play, pause, and volume controls to control the video.

At the same time, the <video> element element also provides width and height attributes to control 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 <video> and </video> tags is provided for display by browsers that do not support the video element.

The<video> element supports multiple <source> elements. The <source> element can link different video files. The browser will use the first recognized format:


Video formats supported by the browser

currently , the <video> element supports three video formats: MP4, WebM, and Ogg:

  • MP4 = MPEG 4 file with H.264 video encoding and AAC audio encoding

  • WebM = WebM file with VP8 video encoding and Vorbis audio encoding

  • Ogg = Ogg file with Theora video encoding and Vorbis audio encoding

? ?瀏覽器? ?MP4? ?WebM? ?Ogg
Internet Explorer? ?YES? ?NO? ?NO
Chrome? ?YES? ?YES? ?YES
Firefox? ?YES? ?YES? ?YES
Safari? ?YES? ?NO? ?NO
OperaYES (from Opera 25) YES YES

Video format

## MP4 WebM## Ogg video/ogg

HTML5 <video> - Control using DOM

HTML5 <video> and <audio> elements also have Methods, properties and events.

The methods, properties, and events of the <video> and <audio> elements can be controlled using JavaScript.

The methods include play, pause, and load. The properties (such as duration, volume, etc.) can be read or set. The DOM events can notify you that, for example, the <video> element has started playing, has been paused, has been stopped, etc.

The simple method in the example shows us how to use the <video> element, read and set attributes, and how to call methods.

<!DOCTYPE html>
<html>
<head> 
    <meta charset="UTF-8">
    <title>php中文網(wǎng)(php.cn)</title> 
</head>
<body>
<div style="text-align:center">
    <button onclick="playPause()">播放/暫停</button>
    <button onclick="makeBig()">放大</button>
    <button onclick="makeSmall()">縮小</button>
    <button onclick="makeNormal()">普通</button>
    <br>
    <video id="videol" width="420">
    <source src="movie.mp4" type="video/mp4">
    <source src="movie.ogg" type="video/ogg">
    您的瀏覽器不支持 HTML5 video 標(biāo)簽。
</video>
</div>
<script>
    var myVideo=document.getElementById("videol");
    function playPause()
    {
        if (myVideo.paused)
            myVideo.play();
        else
            myVideo.pause();
    }
    function makeBig()
    {
        myVideo.width=560;
    }
    function makeSmall()
    {
        myVideo.width=320;
    }
    function makeNormal()
    {
        myVideo.width=420;
    }
</script>
</body>
</html>

Try to run it


For more reference, please check the HTML5 Audio/Video DOM Reference Manual.



##HTML5 Video Tags


##Format MIME-type
video/mp4
video/webm
<video> <source>## <track> is defined in the media player text track## Continuing Learning
||
<!DOCTYPE html> <html> <head>  <meta charset="UTF-8"> <title>php中文網(wǎng)(php.cn)</title>  </head> <body> <div style="text-align:center"> <button onclick="playPause()">播放/暫停</button> <button onclick="makeBig()">放大</button> <button onclick="makeSmall()">縮小</button> <button onclick="makeNormal()">普通</button> <br> <video id="videol" width="420"> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> 您的瀏覽器不支持 HTML5 video 標(biāo)簽。 </video> </div> <script> var myVideo=document.getElementById("videol"); function playPause() { if (myVideo.paused) myVideo.play(); else myVideo.pause(); } function makeBig() { myVideo.width=560; } function makeSmall() { myVideo.width=320; } function makeNormal() { myVideo.width=420; } </script> </body> </html>
submitReset Code
## Tag Description
Define a video
Define multiple media resources, such as <video> and <audio>
          <em id="efxe5"><samp id="efxe5"><pre id="efxe5"></pre></samp></em>
          <center id="efxe5"></center>
                    <blockquote id="efxe5"><p id="efxe5"></p></blockquote>