[GH-ISSUE #626] [Feature]: YouTube Music DJ companion to Spotify Game Mode DJ #292

Closed
opened 2026-10-20 17:27:14 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (May 10, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/626

What problem does this solve?

Marinara recently shipped a Spotify DJ for Game Mode (#624 / #623 / b3fce6c) and /play commands in Conversation Mode. Users without Spotify Premium (or who simply prefer YouTube Music) currently have no in-app music option. A YouTube counterpart would extend the same scene-aware DJ experience to the much larger YouTube user base.

Proposed solution

Add a YouTube DJ feature that mirrors the Spotify integration's surfaces wherever the platform allows, and is honest about where it can't:

  • Auth: Per-user Google OAuth (scope https://www.googleapis.com/auth/youtube.readonly), parallel to spotify-auth.routes.ts. Token storage encrypted the same way as Spotify credentials.
  • Game Mode scene music: New game-youtube-music.service.ts parallel to game-spotify-music.service.ts — picks a track per scene based on narration, plays via the IFrame Player API embedded in the client.
  • Conversation /play commands: New conversation-youtube-command.service.ts parallel to the Spotify one.
  • Mini player: New YouTubeMiniPlayer.tsx parallel to SpotifyMiniPlayer.tsx, using a hidden YouTube IFrame for audio + custom controls for play/pause/skip/volume.
  • Coexistence: Mutually exclusive per chat — UI prevents enabling both Spotify and YouTube music in the same chat.
  • Sources: "Search" (free-text via Data API v3) and "Playlist" (user's regular YouTube playlists, fetched via /playlists?mine=true). "Liked Songs" / "Library" sources are intentionally not supported because the YouTube Data API does not expose YT Music Library/Likes; this is documented up front so users know what to expect.
  • Out of scope for this issue: a YT Music equivalent of "DJ Mari" (would require library access we cannot get via official APIs).

Alternatives considered

  • Unofficial scrape APIs (ytmusicapi-style): Would give us full YT Music Library/Likes parity with Spotify, but it requires the user to paste a headers_auth.json cookie blob, lives outside YouTube's ToS, and breaks whenever Google changes the internal endpoints. Rejected in favor of official-only APIs.
  • YOUTUBE_API_KEY only (no per-user OAuth): Simpler to set up but cannot read a user's own playlists at all (only public ones by ID). Rejected because it loses the "my playlist" source and the per-user UX feels worse than Spotify's.
  • Skipping YouTube entirely: Spotify is the only major service with a Web Playback-style remote-control API, so users without Spotify currently have no music option. The IFrame route is meaningfully different from Spotify (player lives in the Marinara tab, not in a separate app), but it's the best official-only path available.

Additional context

  • Mirrors the Spotify integration shipped in PRs #624 and #623 (and earlier b3fce6c).
  • New env var: YOUTUBE_REDIRECT_URI (parallel to SPOTIFY_REDIRECT_URI), plus YOUTUBE_CLIENT_ID / YOUTUBE_CLIENT_SECRET.
  • CSP frame-src will need to allow www.youtube.com and www.youtube-nocookie.com for the IFrame player.
  • Docs deltas planned: .env.example, CONFIGURATION.md (auth setup), TROUBLESHOOTING.md (LAN / non-loopback redirect — same workaround as Spotify), FAQ.md, CHANGELOG.md.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (May 10, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/626 ## What problem does this solve? Marinara recently shipped a Spotify DJ for Game Mode (#624 / #623 / `b3fce6c`) and `/play` commands in Conversation Mode. Users without Spotify Premium (or who simply prefer YouTube Music) currently have no in-app music option. A YouTube counterpart would extend the same scene-aware DJ experience to the much larger YouTube user base. ## Proposed solution Add a YouTube DJ feature that mirrors the Spotify integration's surfaces wherever the platform allows, and is honest about where it can't: - **Auth**: Per-user Google OAuth (scope `https://www.googleapis.com/auth/youtube.readonly`), parallel to `spotify-auth.routes.ts`. Token storage encrypted the same way as Spotify credentials. - **Game Mode scene music**: New `game-youtube-music.service.ts` parallel to `game-spotify-music.service.ts` — picks a track per scene based on narration, plays via the IFrame Player API embedded in the client. - **Conversation `/play` commands**: New `conversation-youtube-command.service.ts` parallel to the Spotify one. - **Mini player**: New `YouTubeMiniPlayer.tsx` parallel to `SpotifyMiniPlayer.tsx`, using a hidden YouTube IFrame for audio + custom controls for play/pause/skip/volume. - **Coexistence**: Mutually exclusive per chat — UI prevents enabling both Spotify and YouTube music in the same chat. - **Sources**: \"Search\" (free-text via Data API v3) and \"Playlist\" (user's regular YouTube playlists, fetched via `/playlists?mine=true`). \"Liked Songs\" / \"Library\" sources are intentionally **not supported** because the YouTube Data API does not expose YT Music Library/Likes; this is documented up front so users know what to expect. - **Out of scope** for this issue: a YT Music equivalent of \"DJ Mari\" (would require library access we cannot get via official APIs). ## Alternatives considered - **Unofficial scrape APIs (`ytmusicapi`-style)**: Would give us full YT Music Library/Likes parity with Spotify, but it requires the user to paste a `headers_auth.json` cookie blob, lives outside YouTube's ToS, and breaks whenever Google changes the internal endpoints. Rejected in favor of official-only APIs. - **`YOUTUBE_API_KEY` only (no per-user OAuth)**: Simpler to set up but cannot read a user's own playlists at all (only public ones by ID). Rejected because it loses the \"my playlist\" source and the per-user UX feels worse than Spotify's. - **Skipping YouTube entirely**: Spotify is the only major service with a Web Playback-style remote-control API, so users without Spotify currently have no music option. The IFrame route is meaningfully different from Spotify (player lives in the Marinara tab, not in a separate app), but it's the best official-only path available. ## Additional context - Mirrors the Spotify integration shipped in PRs #624 and #623 (and earlier `b3fce6c`). - New env var: `YOUTUBE_REDIRECT_URI` (parallel to `SPOTIFY_REDIRECT_URI`), plus `YOUTUBE_CLIENT_ID` / `YOUTUBE_CLIENT_SECRET`. - CSP `frame-src` will need to allow `www.youtube.com` and `www.youtube-nocookie.com` for the IFrame player. - Docs deltas planned: `.env.example`, `CONFIGURATION.md` (auth setup), `TROUBLESHOOTING.md` (LAN / non-loopback redirect — same workaround as Spotify), `FAQ.md`, `CHANGELOG.md`. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:27:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#292
No description provided.