Riff / Built on the open web / Media

Network Information

Respects Data Saver by fetching nothing before a press.

A post with its tracks listed, and the player bar along the bottom of the screen
With Data Saver on, these rows fetch nothing until one is tapped.

How Riff uses it

At startup the script reads navigator.connection.saveData. When Data Saver is on, it sets preload to none on both media elements, overriding the template's metadata.

Why

On a metered connection the player should not download even a track's metadata before the listener presses play.

Without it

The property is optionally chained, so browsers without it keep the template's preload.

Where

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

Reference: Network Information on MDN.