How to insert audio and video into web pages in html?

黄舟
Release: 2017-06-19 11:20:43
Original
18514 people have browsed it

Common multimedia files in web pages include audio files and video files. For online audio and video, we often use the embed tag to insert .

embed syntax:

<embed src=”视频地址” type=”audio/x-pn-realaudio-plugin” console=”Clip1〃 controls=”ControlPanel,StatusBar” height=”330〃 width=”450〃 autostart=”true”>

<embed src="要播放的文件网址"; autostart="true" loop="true" width="400" height="350" >
Copy after login

Example 1: Insert audio file

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>插入音频文件</title>
</head>
<body>
    <embed src="media/西班牙舞曲.mp3" width="400px" height="80px"/>
</body>
</html>
Copy after login

The preview effect in the browser is as follows:

How to insert audio and video into web pages in html?

Instructions:

We can see that using the embed tag to insert audio files will also have a playback interface with several simple functions buttons.

Example 2: Insert video file

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>插入音频文件</title>
</head>
<body>
    <embed src="media/小苹果.wmv" width="400px" height="80px"/>
</body>
</html>
Copy after login

The preview effect in the browser is as follows:

How to insert audio and video into web pages in html?

Note:

Since the audio and video files are relatively large, we do not provide you with the online testing function here. However, you can test the code on your own computer.

Use the embed tag to insert a video. We can also see it in the browser. The browser provides a simple operation interface. The embed tag supports many video formats, and most mainstream formats are supported.

The embed tag can support most formats of video files. Anyway, mainstream ones such as .mp4, .avi, .rmvb, etc. are all supported. If you cannot play the video using the embed tag, there may be a problem with your video format or encoding. You can use Format Factory to convert the format.

The above is the detailed content of How to insert audio and video into web pages in html?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template