HTML5 can use video tags to play videos
Currently, the video element supports three types of videos:
5.0+
format |
ie |
Firefox |
Opera |
Chrome |
Safari |
Ogg |
No |
3.5+ |
10.5+ |
5.0+ |
No |
mpeg 4 |
9.0+ |
No |
no |
3.0+ |
WebM |
No |
4.0+ |
10.6+ |
6.0 + |
No |
Ogg = Ogg file with Theora video encoding and Vorbis audio encoding
MPEG4 = mpeg 4 files with H.264 video encoding and AAC audio encoding
WebM = WebM file with VP8 video encoding and Vorbis audio encoding
The code is as follows |
Copy Code |
<video width= "height=" controls= "Controls" >
<source src= "Movie.ogg" type= "Video/ogg" >
<source src= "Movie.mp4" type= "Video/mp4" >
Your Browser does not support the "video tag."
</video> |
The video element allows multiple source elements. The source element can link different video files. The browser will use the first recognizable format!
This ensures that all browsers are compatible
Audio also has a audio tag
Currently, the audio element supports three audio formats:
ie 9 |
Firefox 3.5 |
Opera 10.5 | Th>chrome 3.0
Safari 3.0 |
ogg Vorbis |
√ |
√ |
√ |
MP3 |
√ |
√ |
√ |
Wav |
√ |
√ |
√ |
The code is as follows |
Copy Code |
<audio controls= "Controls" >
<source src= "Song.ogg" type= "Audio/ogg" >
<source src= " Song.mp3 "type=" Audio/mpeg ">
Your Browser does not support the audio tag.
</audio> |