bryanhamilton.info / open source / preview-media-session

preview-media-session

one dependency-free file that makes the OS media popover show the track and cover art instead of the page title when an audio preview plays

In brief: preview-media-session is part of the open-source set extracted from the production code of The DJ Calendar (~1,000 structured-data pages, shipping since 2015). Built to run on cheap shared hosting with zero build step. View the code on GitHub →

The problem it fixes

Without Media Session metadata, macOS, iOS and Android fall back to the page title - so hovering a DJ name and playing a 30-second iTunes preview popped up "My Site - Home" in the media popover instead of the song. This file fixes that.

What it does

Usage

One script tag, one constructor, two calls:

Frequently asked questions

What does preview-media-session do?

one dependency-free file that makes the OS media popover show the track and cover art instead of the page title when an audio preview plays

Where is the code?

The repository is at https://github.com/bryanhamiltondev/preview-media-session - production-extracted, MIT-licensed where noted in the repo.

Need someone who ships like this?

Bryan Hamilton is a full-stack web engineer with 25+ years in PHP and JavaScript, available immediately for remote, hybrid or on-site roles in the NYC metro area.

Book a 30-min call →   Tech resume   All projects