Technical Notes
Audio Element Attributes
β
<audio> element β all standard attributes:
<audio> element β all standard attributes:src
URL
URL of the audio file (optional if <source> used)
controls
Boolean
Shows browserβs built-in audio controls
autoplay
Boolean
Starts playing automatically when loaded
loop
Boolean
Restarts playback when audio ends
muted
Boolean
Starts playback muted
preload
Enum
Hints to browser about preloading: none, metadata, or auto
crossorigin
Enum
Controls CORS: anonymous or use-credentials
playsinline
Boolean
(iOS Safari) Prevents fullscreen when audio is played
disableRemotePlayback
Boolean
Prevents casting to remote playback devices
class, id, style, title, etc.
Global attributes
Standard HTML global attributes
β
<source> element β all standard attributes:
<source> element β all standard attributes:src
URL
URL of the media file
type
MIME
Media type (e.g., audio/mpeg, audio/ogg)
media
Media query
Optional: apply only if media query matches
sizes
(unused in audio/video)
Mostly relevant for <img> in srcset
srcset
(unused in audio/video)
Not applicable for <audio> or <video>
Notes:
<audio>may usesrcdirectly or contain multiple<source>elements.<source>elements allow fallbacks and are used in sequence.Boolean attributes are true if present, false if omitted.
Blank src
Yes, a <source> element with no src will be safely ignored by all major browsers during media selection.
Behavior:
The browser processes
<source>elements in order.If a
<source>has nosrc, it is skipped, even iftypeis valid.This is defined in the HTML spec: the
srcattribute is required; if missing or empty, the source is considered invalid and ignored.
Example:
This is safe and will not cause errors or warnings in any standards-compliant browser.
Last updated