feat(player,genre-tree): add YouTube-backed playback for reference tracks - #30
Merged
Merged
Conversation
…adedTrack/YoutubeTrack discriminated union gtmt-api has no self-hosted audio storage, so reference-tree tracks now play as embedded YouTube videos instead. `PlayerTrack` is a discriminated union (`AudioPlayerTrack` | `YoutubePlayerTrack`) driven through a new `MediaController` interface (`AudioMediaController` / `YoutubeMediaController`), so play/pause/seek code no longer branches on track kind. YouTube tracks play through the YouTube IFrame Player API, lazy-loaded once per page and mounted into a new `<PlayerVideoSurface />` component. `TrackDetailedSchema` becomes a real union (`UploadedTrackDetailed` | `YoutubeTrackDetailed`), each stamped with a `kind` field, replacing the old flat schema. `libraryEndpoints.reference` now exposes `.youtube` (list/detail/delete, mirroring gtmt-api's `YoutubeTrackViewSet`) instead of `.uploaded`. `TrackItem`'s edit affordance is gated on `kind === "uploaded"`, matching gtmt-api having no update route for YouTube tracks. Renamed the playlist-relation fields that mirror gtmt-api's `UploadedTrack` → `Track` rename: `.uploadedTrack` → `.track`, `.uploadedTrackPlaylistRelations` → `.trackPlaylistRelations`, `.uploadedTracksCount`/`.uploadedTracksArchivedCount` → `.tracksCount`/`.tracksArchivedCount`, `.uploadedTracks` → `.tracks`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
grow-the-music-tree-api removed its redundant reference/ route prefix (every route lived under it with no unscoped counterpart); mirror that here so these endpoint builders keep matching the real backend paths.
…erized builder Matches the makeXEndpoints(prefix) pattern already used by library/uploaded and library/youtube, instead of duplicating the me/reference shape by hand.
Comments should describe current behavior, not where code was moved from or what a consuming app used to hardcode.
…ationAction Rename should behave identically across consumers, not be an optional no-op if omitted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…yground parseWithLog/useQueryWithParse/useValidatedMutation typed their schema param as z.ZodType<T> (Input defaults to Output), which breaks for any .transform()-based schema whose input lacks a synthetically-stamped field (e.g. the kind discriminant on Uploaded/YoutubeTrackDetailed). Widen Input to unknown since callers only rely on the parsed Output type. apps/playground was still on the pre-YouTube-migration uploaded/download track API and missing the now-required handleGenreRenameAction prop, previously masked by the package-level build failure above. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
grow-the-music-tree-apihas no self-hosted audio storage, so reference-tree track playback is moving to embedded YouTube videos instead of downloaded audio files.grow-the-music-tree-frontend.Changes
PlayerTrackis now a discriminated union (AudioPlayerTrack|YoutubePlayerTrack) instead of a single audio-only shape.MediaControllerinterface (AudioMediaController/YoutubeMediaController) unifies play/pause/seek/volume across both kinds —PlayerContextno longer branches on track kind for playback control.PlayerTrackObject.audioElementis replaced byPlayerTrackObject.mediaController— a breaking change for consumers reading the audio element directly (hear-the-music-tree-frontendneeds a mechanical rename, tracked separately).loadYoutubeIframeApi), mounted into a new<PlayerVideoSurface />component consumers render wherever the video should appear.TrackDetailedSchemais now a real discriminated union (UploadedTrackDetailed | YoutubeTrackDetailed), each tagged with akindfield stamped via.transform()on the parsed output (neither backend sendskindon the wire — each route only ever serves one track kind).UploadedTrackDetailedSchemakeepsrelativeUrl/filerequired; the newYoutubeTrackDetailedSchemarequiresyoutubeVideoIdand has no file fields.useUploadTrack,useUpdateUploadedTrack,UploadedTrackEditionPopup,useTrackEdition) are typed againstUploadedTrackDetailedspecifically; list/playback surfaces stay on the genericTrackDetailedunion.TrackItemgates its edit affordance ontrack.kind === "uploaded", sincegrow-the-music-tree-api'sYoutubeTrackViewSethas no update route.grow-the-music-tree-api'sUploadedTrack→Trackrename:.uploadedTrack→.track,.uploadedTrackPlaylistRelations→.trackPlaylistRelations,.uploadedTracksCount/.uploadedTracksArchivedCount→.tracksCount/.tracksArchivedCount,.uploadedTracks→.tracks.hear-the-music-treedoesn't consume the criteria/criteria-playlist schemas, so this only affectsgrow-the-music-tree-frontend.libraryEndpoints.referencenow exposes.youtube(list/detail/delete only) instead of.uploaded;libraryEndpoints.me.uploaded(hear-the-music-tree's real uploaded-audio flow) is unchanged.Test plan
hear-the-music-tree-frontendstill typechecks/builds against the extended types once its companionmediaControllerrename branch is applied (audio-only code path is otherwise untouched).