How googlearchive/drive-music-player works
Project type and purpose (what you’re diagramming)
This repo is a fully client-side web application (static HTML/CSS/JS) that acts as a music player for audio files stored in Google Drive. There is no server-side backend owned by the project. The “system” is essentially:
• A browser-based SPA-ish app (index.html + JS modules)
• Integrations with Google Drive APIs / Google OAuth (to list/read files)
• Optional integration with Last.fm (scrobbling/metadata)
• Local parsing of audio metadata (ID3/AAC tags) and playback via a JS audio player library
Top-level entrypoints / app shell
• index.html → app shell, bootstraps scripts and UI container.
• css/drive-music-player.css → core styling.
• images/ → cursors/visual assets.
Application logic (your “modules” / “layers”)
All under js/:
• js/dmp.js → likely the main orchestrator / app bootstrap.
• js/dmp.ui.js → UI rendering, event binding, view updates.
• js/dmp.player.js → playback control (play/pause/seek/volume), probably wraps jPlayer.
• js/dmp.playlist.js → playlist model, ordering, navigation between tracks.
• js/dmp.drive.js → Google Drive integration: auth/session, file listing, file download/stream URLs, “Open with” flow.
• js/dmp.lastfm.js → Last.fm integration (scrobbling or metadata).
• js/dmp.url.js → URL/state management (deep links, query params, Drive “open with” ids).
• js/base64.js → utility.
These strongly suggest drawing an internal separation:
• UI layer
• Domain layer (playlist/player state)
• Integration layer (Drive, Last.fm)
• 3rd-party libraries
Third-party libraries (explicit vendor components)
Under third-party/:
• third-party/jplayer/… (and swfobject/…) → playback engine (HTML5 audio + fallback Flash).
• third-party/id3-tag-reader/… + third-party/jdataview/… → client-side binary parsing and tag extraction (ID3v1/v2, MP4/AAC tags).
• manifest.json, manifest.webapp → web app / installable app metadata.
• cws/manifest.json + cws/* assets → Chrome Web Store packaging for the app/extension.
• app.yaml → likely Google App Engine config for static hosting at driveplayer.com (even though no backend logic, hosting still exists).
These imply multiple “delivery channels”:
• Static hosting (App Engine or similar)
• Chrome Web Store distribution
• “Open with Google Drive” integration
README-derived architecture constraints and flows
Key constraints from README:
• “Entirely client side and does not require any server side component.”
• Supports “Open-with from Google Drive UI” → there’s an inbound launch context from Drive (fileId(s), state, and auth).
• Plays multiple audio formats and reads tags → requires binary fetch of file content + parsing + UI updates.
• “Handles users signed-in multiple Google account” → implies an auth/session manager inside dmp.drive.js (token handling, account switching).
• Browser ↔ Google OAuth
• Browser ↔ Google Drive API (metadata listing + file content download/stream)
• Browser ↔ Last.fm API (optional)
• Internal: Player ↔ Playlist ↔ UI, and Tag Reader ↔ UI/Playlist
App load
• User Browser → Static Hosting → delivers index.html, css, js, third-party/*
Authentication
• Drive Music Player → Google OAuth → returns access token
• Token stored/managed inside Drive integration module
File discovery & open-with
• (Path A) User opens app normally:
• App → Google Drive API: list files/folders / search audio
• (Path B) User uses “Open with” in Drive:
• Google Drive UI → launches app with fileId(s) (URL params/state) → dmp.url.js/dmp.drive.js consumes it
Playback
• App → Google Drive API: fetch file bytes / stream URL
• Player module → jPlayer: decode/play audio in browser (Flash fallback via SWFObject, if applicable)
Metadata extraction (tags + album art)
• App obtains file bytes (or partial range) → ID3 Tag Reader/jDataView → returns tags/art
• Metadata → UI module (now playing info) and/or Playlist module (track listing)
Scrobbling / external metadata (optional)
• App → Last.fm API: scrobble “now playing” / track played events
Architectural patterns used
• Client-only architecture: no custom backend; all state and logic in browser.
• Modular JS design: separate modules for UI, player, playlist, integrations.
• External-API-driven: Drive API is the “data store” and content source.
• Library-wrapped playback: app logic wraps jPlayer; parsing wraps ID3 reader.
• HTML/CSS/JavaScript
• Google Drive API + OAuth 2.0
• jPlayer (HTML5 Audio + Flash fallback)
• ID3 tag parsing (id3-tag-reader, jDataView)
• Last.fm API (optional)
• Chrome Web Store packaging + “Open with Drive” integration
2) Packaging & deployment context (how it’s shipped: App Engine hosting + Chrome Web Store)