Posts in current category
May 03, 2021 12:29 HTML
There are many ways to play video in HTML.
Playing videos in HTML is not easy!
You need to know a lot of tricks to make sure your video files play in all browsers (Internet Explorer, Chrome, Firefox, Safari, Opera) and all hardware (PC, Mac, iPad, iPhone).
In this chapter, W3CSchool summarizes the problems and solutions for you.
The role of labels is to embed multimedia elements in HTML pages.
The following HTML code shows flash video embedded in a Web page:
The role of tags is to embed multimedia elements in HTML pages.
The following HTML clip shows a Flash video embedded in a Web page:
HTML5 - lt; video . . . tags define a video or movie.
The element is supported in all modern browsers.
The following HTML clip shows a video in ogg, mp4, or webm format embedded in a Web page:
ogg: Ogg file with Theora video encoding and Vorbis audio encoding
mp4:mp4 file with H.264 video encoding and AAC audio encoding
webm: Webm file with VP8 video encoding and Vorbis audio encoding
Four different video formats are used in the following examples. H tml 5 and video elements try to play the video in one of the mp4, ogg, or webm formats. If both fail, fall back to the element.
The easiest way to display video in HTML is to use a video site such as Youku.
If you want to play a video on a Web page, you can upload the video to a video site such as Youku and insert an HTML code into your web page to play the video:
<embed src="http://player.youku.com/player.php/sid/XMzI2NTc4NTMy/v.swf" rel="external nofollow" width="480" height="400" type="application/x-shockwave-flash"> </embed>
If a Web page contains hyperlinks to media files, most browsers use Secondary Applications to play the files.
The following snippets show links to AVI files. If the user clicks on the link, the browser launches a "secondary application", such as Windows Media Player, to play the AVI file:
When a video is included in a Web page, it is called inline video.
If you're planning to use inline video in a web application, you need to realize that many people find inline video annoying.
Also note that the user may have turned off the inline video option in the browser.
Our best advice is to include inline videos only where users want them. A positive example is when a user needs to see the video and click a link, the page opens and the video plays.
New : HTML5 new label.
|<embed>||定义内嵌对象。HTML4 中不赞成，HTML5 中允许。|
|<source> New||定义了media元素的多媒体资源(<video> 和 <audio>)|
|<track> New||规定media元素的字幕文件或其他包含文本的文件 (<video> 和<audio>)|