Riff / Built on the open web / Media

Web Audio

Reads the signal that lights the filament.

A post with its tracks listed, and the player bar along the bottom of the screen
The filament on the bar's seek line is lit by the signal's level read through Web Audio.

How Riff uses it

The first time something plays through the audio element on a non-iOS browser, the script creates an AudioContext. It wraps the element in a media source and connects it through an analyser and back to the destination, so the sound still comes out. The context suspends on pause and resumes on play.

Why

This is what drives the amber filament. On iOS the graph breaks lock-screen and background playback, so iPhones are left out.

Without it

Where there is no analyser the wire breathes at working temperature on a fixed loop instead.

Where

Links open the source at the commit this page was published from.

Reference: Web Audio on MDN.