How revir/spotify-on-browser works
Project type and purpose
• This is a browser‐extension project (Chrome, Firefox, Edge) whose goal is to present a “Spotify Connect”–style player inside the browser.
• It implements a custom Spotify Connect endpoint so users can send playback from their phone/desktop Spotify client to the browser, control it with global shortcuts, and keep it running in the background without an open tab.
File structure
Top‐level files and folders:
• manifest.json (extension entrypoint)
• src/
– authorized.html (OAuth redirect page)
– offscreen.html (headless UI for background audio)
– player.html (main popup/UI)
– option.html + src/option/* (settings page)
– background/ (service worker–style scripts)
– content/ (injected scripts for Spotify web player)
– fonts/, images/, vendor/
– utils.coffee (shared utilities)
• utils/
– build.js, env.js, webserver.js (dev server & build helpers)
– autoReloadClients/ (hot‐reload for dev background & content scripts)
• webpack.config.js (bundling)
• pack.sh (packaging script)
Architectural patterns implied:
– Chrome Extension “Manifest v2/v3” model with distinct entry points
– Publisher–subscriber messaging between background and content scripts
– OAuth redirect flow (authorized.html)
– Offscreen document for continuous audio playback
README for additional insights
• Describes user flow: OAuth → inject into Spotify tab → transfer playback → background player
• Mentions using Spotify Web API and Spotify Connect protocols
• Build instructions reference webpack/dev‐server and build output to build/