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" >
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>
The preview effect in the browser is as follows:
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>
The preview effect in the browser is as follows:
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!