npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kud/macos-nowplaying-bridge

v0.1.0

Published

Publish Now Playing metadata to macOS Control Center and receive its media-button events, from Node

Readme

TypeScript Node.js npm MIT

Publish Now Playing metadata to macOS Control Center and receive its media-button events, from Node

Website · Documentation

Features

  • Control Center ownership — claims the Now Playing slot via a silent audio session, so your app's track info appears in Control Center regardless of what other apps are doing.
  • Media-button events — play, pause, toggle, next, and previous button presses from Control Center (or media keys) are forwarded back to Node as typed events.
  • Rich metadata — push title, artist, album, artwork URL, duration, elapsed time, playback rate, and play/pause state; Control Center reflects changes immediately.
  • Zero npm dependencies — ships a Swift source file compiled lazily on first call with swiftc and wrapped in a minimal .app bundle (required by macOS for Now Playing access).
  • No prebuilt binaries — on-demand compilation means no architecture-specific blobs and no native binding steps; the binary is cached in $TMPDIR for subsequent runs.
  • macOS only, deliberately — the "os": ["darwin"] guard in package.json prevents accidental installation on unsupported platforms.

Install

npm install @kud/macos-nowplaying-bridge

Requires macOS and Node.js ≥ 20. swiftc must be available (ships with Xcode Command Line Tools).

Usage

import { createNowPlayingBridge } from "@kud/macos-nowplaying-bridge"

const bridge = await createNowPlayingBridge()

// Push track metadata to Control Center
bridge.update({
  title: "Intro",
  artist: "The xx",
  album: "xx",
  duration: 126,
  elapsed: 30,
  state: "playing",
})

// React to Control Center / media-key events
bridge.on("next", () => playNextTrack())
bridge.on("previous", () => playPreviousTrack())
bridge.on("toggle", () => togglePlayback())

// Tear down the co-process when done
bridge.stop()

API

createNowPlayingBridge(): Promise<NowPlayingBridge>

Compiles and spawns the Swift co-process on first call (subsequent calls reuse the cached binary). Throws on non-macOS platforms.

bridge.update(info: NowPlayingInfo): void

Pushes a metadata update. All fields except title are optional.

| Field | Type | Description | | ------------ | ----------------------- | ------------------------------------ | | title | string | Track title (required) | | artist | string | Artist name | | album | string | Album name | | artworkUrl | string | Remote or file:// artwork URL | | duration | number | Total track length in seconds | | elapsed | number | Current playback position in seconds | | rate | number | Playback rate (1.0 = normal speed) | | state | "playing" \| "paused" | Playback state |

bridge.on(event: RemoteEvent, handler: () => void): void

Registers a handler for a media-button event. Multiple handlers per event are supported.

RemoteEvent values: "play" · "pause" · "toggle" · "next" · "previous"

bridge.stop(): void

Kills the Swift co-process and releases the Now Playing slot.

Development

git clone https://github.com/kud/macos-nowplaying-bridge.git
cd macos-nowplaying-bridge
npm install
npm run dev

| Script | Purpose | | ------------------- | ---------------------------- | | npm run build | Compile TypeScript with tsup | | npm run dev | Watch mode | | npm run typecheck | Type-check without emitting | | npm test | Run vitest suite |

📚 Full documentation → macos-nowplaying-bridge/docs