Technology Encyclopedia Home >What are the video and audio tags in HTML5?

What are the video and audio tags in HTML5?

In HTML5, the <video> and <audio> tags are used to embed video and audio content directly within a web page without the need for third-party plugins like Flash.

Video Tag

The <video> tag allows you to embed video content. It supports various video formats such as MP4, WebM, and Ogg. You can also specify controls to allow users to play, pause, and adjust the volume of the video.

Example:

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Audio Tag

The <audio> tag is used to embed audio content. It supports formats like MP3, WAV, and Ogg. Similar to the <video> tag, you can add controls for play, pause, and volume adjustment.

Example:

<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
  <source src="audio.ogg" type="audio/ogg">
  Your browser does not support the audio tag.
</audio>

Cloud Services for Media Hosting

For hosting and streaming media content, cloud services like Tencent Cloud offer solutions such as Tencent Cloud Media Processing Service, which provides video and audio processing capabilities, including encoding, transcoding, and streaming. This can be integrated with your web application to deliver media content efficiently.