Adding Audio and Video in HTML
×
Home Courses Community Support
Adding Audio and Video in HTML

To reprenest something using audio or video is a good idea. And many times we require to use audio/video for our website. We can do so by using embed tag. Embed tag allow us to add video file or audio file by using it's path.

See below example to use video in a webpage-

<!DOCTYPE html>
<html>
<head><title>Video in HTML</title></head>
<body>
<embed src="media/variable.mp4"> </embed>
</body>
</html>

 

The above code will add a video to the webpage.

Same code be can be used in case of audio like given below-

<!DOCTYPE html>
<html>
<head><title>Audio in HTML</title></head>
<body>
<embed src="media/Gaytri_Mantra.mp3"> </embed>
</body>
</html>

 

If you want to use audio as background sound only then use the tag <bssound> instead of <embed>.

See below code -

<!DOCTYPE html>
<html>
<head><title>Background Audio in HTML</title></head>
<body>
<bgsound src="media/Gaytri_Mantra.mp3">
</body>
</html>

 

Above code will play the audio in background. It will not visible to users.

Run the code in CodeLAB.

 

← Preview

Character Encoding in HTML

Next →

Integrate YouTube video using Iframe

NOTES

Our mission is to provide highly effective and quality education via innovative solutions. Geeksdemy look forward to bridge the gap between in-demand technology and academics in order to deliver innovative, easy, interesting and affordable learning across the Globe.

Courses

  • Python
  • Game Development with Unity 3D
  • Arduino
  • PCB & Circuit Designing
  • Robotics and Embedded C
  • 8051/8052 Embedded Systems
  • QuadCopter & UAV
  • MATLAB with Robotics
  • Raspberry Pi
Learn On the Go!
Get the Android App
Get the iOS App