~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
24 lines · 990 B Raw History
// What plays in the workspace: one <audio>, mounted once by the page, apart
// from every tile, so music goes on as tiles are scrolled away, closed or
// refreshed, tabs switched and canvases put away. A tile's players play
// through it as the tile's (`origin`), and the mini player shows it, going
// back to that tile while it is open. It holds only the tracks it plays.

import { AudioHost } from '@hud/renderer';

/** Where a queue came from: a tile of a canvas. */
export type Source = { canvas: string; tile: string };

export class NowPlaying extends AudioHost {
	/** A tile's origin, as its players play: a string, so a tile drawn again names the same. */
	static origin(canvas: string, tile: string): string {
		return JSON.stringify([canvas, tile]);
	}

	/** The tile what plays came from. */
	get source(): Source | null {
		if (typeof this.origin !== 'string') return null;
		const [canvas, tile] = JSON.parse(this.origin) as [string, string];
		return { canvas, tile };
	}
}