I want a native fade-in/fade-out attribute for HTML media elements

Submitted by Sam Henri-Gold

This idea is currently being discussed.

I want a native fade-duration attribute (or equivalent) on HTML media elements — such as <audio> and <video> — that automatically applies a fade-in when playback starts and a fade-out when it ends or is paused.

While building a song sampler using the iTunes Store API, I found that the 30-second preview clips have no fade-in or fade-out baked in, which makes them sound abrupt. Implementing fades in JavaScript requires either the Web Audio API's GainNode (which adds meaningful complexity) or hacky volume-ramping loops with setInterval.

Something as simple as <audio fade-duration="500ms"> would make audio handling far more polished and accessible to developers of all skill levels, without requiring them to reach for the Web Audio API for what is a very common, presentational concern.

Tagged
HTML Api
Votes
0
What are votes for and how are they tallied?