HTML5 multimedia tags and video tags
- Multimedia label
audio tag<audio src="文件地址" controls="controls"></audio>
support limited formats, supports three main formats
1.Ogg Vorbis (used)
2.MP3 (common)
3.Wav
property:
1.autoplay = "autopaly" (audio playback immediately after the ready, Google browser is disabled Automatically play)
2.controls=“controls” (display controls to the user, such as the play button, different browsers display different controls)
3.loop=“loop” (restart playing when the audio ends)
4.src=""( File name to be played)
Because different browsers support different formats, we need to prepare multiple formats for this audio
<audio controls="controls">
<source src="happy.mp3" type="audio/mpeg">
<source src="happy.ogg" type="audio/ogg">
您的浏览器不支持audio标签
</audio>
- Video tag
Video tag video
format:
1. Ogg (commonly used)
2. MPEG 4 (commonly used)
3. WebM
solves compatibility:
<video controls="controls">
<source src="move.ogg" type="video/agg">
<source src="move.mp4" type="video/mp4">
您的浏览器不支持video标签
</video>
Common attributes:
autoplay="autoplay" (autoplay, Google prohibits autoplay, you need to add muted="muted" (muted playback) attribute to automatically play)
controls="controls" (display playback controls)
width="...px" (player width )
height="…px" (player height)
loop="loop" (loop playback)
preload="proload" (whether to wait for loading and then play)
src="url" (video address)
poster="imgurl" (load Waiting screen picture)
muted=“muted” (silent playback)