OnlineCBT Logo OnlineCBT
HTML Tutorial
HTML · LESSON 21

Audio Element

By Ratan Updated: 16 Oct 2026

Embed audio files (MP3, WAV, OGG) with native browser playback controls using <audio> tag.

Level: Beginner to Advanced
Duration: ~60 Mins Deep-Dive

1. Embedding Audio in HTML5

The HTML5 element allows web applications to stream audio recordings, pronunciation guides, and lecture podcasts natively without requiring external flash plugins.

2. Standard Syntax & Attributes


3. Core Audio Attributes

  • controls: Renders browser native playback controls (Play/Pause button, seekbar, volume slider, mute toggle).
  • autoplay: Begins playing audio automatically upon load (most browsers restrict autoplay unless muted).
  • loop: Automatically restarts playback when audio reaches the end.
  • muted: Sets the default audio track state to muted.
  • preload: Hints how much audio to load before interaction:
    • none: Do not pre-buffer audio (saves bandwidth).
    • metadata: Preload track duration and dimensions only (recommended).
    • auto: Preload entire audio stream immediately.

📝 Live Lesson Practice

HTML/CSS JavaScript Python C++ C PHP
⌨️ Practice Inputs (लाइव इनपुट भरें) (खाली होने पर RED, भरने पर GREEN underline)
💻 Code Editor (Monaco VS Code Engine)
👀 Live Preview
पता संपर्क करें

+91 7877547686

ई-मेल

onlinecbtportal@gmail.com

हेल्पलाइन नंबर

+91 7877547686


डाउनलोड करने के लिए क्लिक करें
Get it on Google Play

ऐप डाउनलोड करने
के लिए Google Play पर
उपलब्ध है

WhatsApp Chat