Table of Contents
Solution development
The description of
tag is used to play videos, and the usage is the same as
进度条" >两种进度条
process
meter
总结
Home Web Front-end H5 Tutorial HTML5--detailed explanation of multimedia tags

HTML5--detailed explanation of multimedia tags

May 08, 2017 pm 01:46 PM

The early Internet was mainly used to share academic results, but for ordinary people, they were more willing to share some more interesting content on it, such as video,audio , these technologies were not solved by the <a href="http://www.php.cn/wiki/1118.html" target="_blank"></a># web audio and video provided by the html tag<a href="http://www.php.cn/code/5011.html" target="_blank"></a> before

html5

Solution development

Although the early html did not provide tags to support video or audio playback, this does not affect people's desire to share

  • Supported method 1:

    • Use embed to directly insert the video into the page, and then you can use Windows Media Player,Apple QuickTimeor actual video player to create a playback window

    • But this method is not controllable for the video itself. Compatibility issues cannot be taken into account

  • ##Support method 2

    • ##Use browser plug-ins, One is Microsoft's
    • Silverlight

      , and the most commonly used Adobe Flash

    • Flash

      not only completely solves the problem of browsing There are server support issues, and the installation rate is staggeringly high (basically 99% of computers have Flash player installed)

    • Using
    • Flash

      except for In addition to learning Flash this technology itself, the more important thing is that iPhone, ipad does not support this technology

    • If you want to see how the video is played, move the mouse to the video window and right-click. If you can see text such as
    • Flash

      , then the website uses the Flash plug-in

  • Multimedia Tags:

    • ##Html5
    • In order to solve the problem use

      Flash Various issues of have introduced multimedia tags

      Due to video format issues, different browsers support different videos of the same format, and multiple copies of the video need to be prepared
    • cannot provide a good protection effect for the played video, because the user can directly save the video file as
    Summary:
  • Although the multimedia tags in
      html5
    • have various disadvantages, we still need to embrace this new technology because of its usage. It’s really very simple

    • audio tag

The description of

audio
in

w3c is Such audio tag

    Sample code 1:
  • The following demonstrates the simplest one How to use
    • src: Audio address
    • controls:Audio playback
    • Controller
    • autoplay
    • :Autoplay

      loop:
    • loop
    • ##poster :Specify the cover to be displayed when the video is not playing

    • <audio src="song.ogg" controls="controls" autoplay loop>
      </audio>
      Copy after login

Sample code 2:
  • src: Audio address
    • Since audio formats are supported differently in different browsers, considering compatibility issues, we need to use the following code

    • source: Specify multiple audios. If one is found that is supported by the current browser, it will be used directly. If all

      source
    • tag formats are not supported, the final text will be displayed. Content
    • ##<div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>&lt;audio controls=&quot;controls&quot;&gt; &lt;source src=&quot;song.ogg&quot; type=&quot;audio/ogg&quot;&gt; &lt;source src=&quot;song.mp3&quot; type=&quot;audio/mpeg&quot;&gt; 你的浏览器不支持此种格式 &lt;/audio&gt;</pre><div class="contentsignin">Copy after login</div></div>Video tag

Video

tag is used to play videos, and the usage is the same as

audio
The tags are very similar

Sample code 1:
  • ##src:

    The address of the video
    • Since video support is different in different browsers, considering compatibility issues, we need to use the following code

    • source:指定多个视频,如果找到了当前浏览器支持的,那么会直接使用,如果所有的source标签格式都不支持,会显示最后的文本内容

<video width="320" height="240" controls="controls">
<source src="movie.ogg" type="video/ogg">
<source src="movie.mp4" type="video/mp4">
你的浏览器不支持video标签
</video>
Copy after login

两种进度条

在html5之前如果我们想要使用进度条,可以通过一些前端框架,或者自己使用控件搭建出类似的外观,但是在html5中推出了两个进度条控件,接下来就让我们来看看如何使用它们

process

  • 外观

    • 如果只是定义该元素<progress><progress/>不设置任何内容,显示效果如下图

HTML5--detailed explanation of multimedia tags

progress.gif

  • 作用:

    • 用来显示任务的进度(进程)

    • 如果想要用来显示度量值(比如容量使用情况)请使用meter标签

  • 属性:

    • max: 总工作量

    • value: 已完成工作量

  • 兼容性:

    • 为了保证显示效果,可以再progress标签中写入内容,在当前浏览器无法显示该控件时,会转而显示内容

meter

  • 外观:

    • 通过属性值的搭配能够显示出多重不同的变化

  • 常见属性:

    • high:规定较高的值

    • low:规定较低的值

    • max:规定最大值(可以超过,但是进度条已经满了)

    • min:规定最小值

    • value:规定度量的值

  • 示例代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<meter class="class1" high="80" low="30" max="100" min="10" value="21" ></meter>
<br/>
<meter class="class2" high="80" low="30" max="100" min="10" value="60"></meter>
<br/>
<meter class="class3" high="80" low="30" max="100" min="10" value="90" ></meter>
<br/>
<meter class="class4" high="80" low="30" max="100" min="10" value="100" optimum="10" ></meter>
<br/>
</body>
</html>
Copy after login

  • 显示效果即截图

HTML5--detailed explanation of multimedia tags

meter.png

总结

两种进度条都能够用来显示进度,由于兼容性以及语义性的问题,在实际开发中需要结合实际情况决定是否使用它们(或者是使用对应的前端框架)。

【相关推荐】

1. 免费h5在线视频教程

2. HTML5 完整版手册

3. php.cn原创html5视频教程

The above is the detailed content of HTML5--detailed explanation of multimedia tags. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles