Skip to content

Repository files navigation

YouTube Music RPC

CI macOS 14+ Swift 6 License: MIT

Native macOS app that embeds YouTube Music and publishes what you're listening to as Discord Rich Presence — track title, artist, artwork, and playback progress bar.

No Electron. No backend. No third-party dependencies. Just Swift and a local Discord IPC socket.

YouTube Music RPC main window


Features

  • Embedded YouTube Music powered by WKWebView — it's just the website, running natively
  • Discord Rich Presence over the local Discord IPC socket (no internet, no server)
  • Track title, artist, album artwork, playback progress, and a "Listen on YouTube Music" button
  • Menu bar extra with playback controls (prev / play-pause / next / stop / reconnect)
  • Launches at login, stays out of the way
  • Zero analytics, zero backend, zero telemetry

Requirements

macOS 14 Sonoma or newer
Discord Desktop app running locally
Build Swift 6 toolchain (for building from source)

Download

Grab the latest .zip from Releases, unzip, and move the app to /Applications.

Security note: The app is ad-hoc signed (no Apple Developer account required). On first launch, right-click → Open to bypass Gatekeeper.

Build from Source

git clone https://github.com/Swift22/youtube-music-rpc.git
cd youtube-music-rpc
./script/build_and_run.sh

That's it — no Xcode project, no CocoaPods, no SPM fetch. The build script assembles the .app bundle from scratch.

Setup

  1. Go to the Discord Developer Portal and create a new application
  2. Copy the Application ID (Client ID)
  3. Launch YouTube Music RPC
  4. Open Settings and paste the Client ID
  5. Start playing something

Development

./script/check.sh      # runs swift test + swift build (same as CI)
swift test             # tests only
swift test --filter DiscordIPC   # single suite

The project has two SwiftPM targets:

  • YTMusicRPCCore — pure library: Discord IPC, bridge model, parsers. No SwiftUI.
  • YouTubeMusicRPCApp — the app: UI, WebView, lifecycle. Depends on Core.

Tests use Swift Testing (import Testing, @Test, #expect()), not XCTest.

Architecture

flowchart LR
  A["SwiftUI app shell"] --> B["WKWebView\nYouTube Music"]
  B --> C["Injected JS bridge"]
  C --> D["TrackStateParser"]
  D --> E["PresenceController"]
  E --> F["Discord IPC socket"]
  G["AppSettings"] --> E
Loading

Full write-up: docs/architecture.md

Known Limitations

Track detection reads navigator.mediaSession.metadata plus DOM fallbacks in YouTube Music's player bar. If YouTube changes their markup, detection can break. The maintenance checklist is in docs/webkit-bridge.md.

Privacy

  • Stores only your Discord Client ID in UserDefaults
  • YouTube session data stays in the system WKWebView data store (same as Safari)
  • Track metadata goes only to the local Discord IPC socket — never leaves your machine
  • No analytics, no crash reporting, no remote anything

Release Builds

./script/package_release.sh

For Developer ID signing and notarization: docs/release.md

Contributing

PRs welcome. See CONTRIBUTING.md.

License

MIT

About

Native macOS app that publishes your YouTube Music track to Discord Rich Presence

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages