Open Source Case Study

Rift Music Player

SwiftSwiftUImacOS
Rift full screen player

The Vision

macOS lacks a dedicated, native music player for YouTube Music. Users are forced to rely on heavy browser tabs or Electron wrappers. I built Rift to solve this: a truly native macOS client that plays music ad-free, maintains local listening stats, and provides instant playback control without ever opening a browser.

Core Objectives

  • Native Experience: Built entirely in SwiftUI for a seamless macOS feel.
  • Ad-Free & Standalone: Direct playback control without browser dependencies.
  • Local Stats: Maintain personal listening history and analytics directly on the device.

Under the Hood

InterfaceCoordinatorPlayback seamSourcesData & servicesExternal · networkMain WindowSidebar · queue · libraryMenu BarCompact transportNotch IslandDynamic-island playerPlayerControllerTransport · queue · now-playing statePlaybackSource · protocolThe sacred seam — source-agnosticWebView PlayerHidden WKWebViewYTM player JS · Google's cipherLocal PlayerAVAudioEngine / AVPlayerUser's own filesDownloadsyt-dlp · out-of-processOffline captureInnerTube ClientSearch · browse · recs · authLibrarySQLite / GRDB · cache · statsKeychainTokens & cookies · encryptedYouTube MusicInnerTube API · catalogGoogle OAuthTV-device flow
Control flowData & stateNetwork

The seam: nothing above PlaybackSource knows whether audio comes from a WebView, a local file, or the yt-dlp downloader. Swap the conformer, keep the UI.

Engineering Deep Dive

Hybrid Playback Engine

WKWebView & JS Bridge

Instead of fighting a cat-and-mouse game against Google's stream ciphers on the backend, I engineered a Hybrid Engine. A hidden WKWebView executes Google's native 'base.js' to legally resolve and play the streams exactly like a browser would, while a JS bridge perfectly syncs playback state (duration, buffering, elapsed) back to the native SwiftUI interface.

Bundled Offline Pipeline

Python & yt-dlp

For offline downloads, I packaged a fully self-contained Python and yt-dlp environment directly into the macOS app bundle. By strictly separating the stream engine (WKWebView) from the download engine (yt-dlp), stream playback remains resilient even if the download API temporarily breaks.

Instant Playback & Local Data

Caching & SwiftData

To eliminate buffering and loading screens, I implemented an aggressive caching layer for audio streams. Combined with SwiftData for local state management and Keychain for secure OAuth storage, the app feels instantly responsive.

The Result

Building Rift taught me that crafting a great user experience often requires hiding immense complexity under the hood. By figuring out how to bundle external binaries (like Python and yt-dlp) securely inside a native Swift application, I was able to bypass Google's walled garden and deliver the exact fluid, ad-free music experience that macOS users have been craving.

Interface Gallery

Home

Rift — Home

Let’s work together

Have a project in mind?

patharia52@gmail.com
Connect & Follow
Open to Work© 2026 Mustafa Patharia. All rights reserved.