Add audio & embed resources (MP3 upload, YouTube, Google Drive)#15
Merged
Conversation
Teachers can attach audio/video resources to a board as canvas objects, alongside images and PDFs. - New `YEmbed` shape kind (audio | youtube | gdrive) with a Konva card (EmbedRenderer) plus a DOM player floated over the stage (MediaOverlayLayer), since Konva's canvas can't host <audio>/<iframe>. The overlay is click-through until the card is selected, so Konva still drives select/drag/resize unchanged. - MP3 upload reuses the existing asset pipeline: AssetKind gains "audio"; importFiles classifies audio/* and places a player card (no decoding). - YouTube/Drive embeds via pasted URL: parseEmbedUrl() normalises watch/ youtu.be/shorts/embed and Drive file/open links to canonical iframe URLs; assetStore.insertEmbed() drops a card at the viewport centre. - AppMenu: accept audio/* in import; new "Embed YouTube / Google Drive" URL popover with inline validation. - Wire "embed" through shapeBounds/translate, ShapesLayer, TransformLayer, and SelectionInspector so transform/move/z-order/lock all apply. - Migration 0003 widens the assets.kind check to allow 'audio'. https://claude.ai/code/session_012m6DUY6q4Vk2WuUh9GtkpA
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.
What
Lets teachers attach audio/video resources to a board as canvas objects, alongside the existing image/PDF imports:
How
Konva renders to
<canvas>, which can't host<audio>/<iframe>. So each resource is a newYEmbedshape drawn as a selectable Konva card (EmbedRenderer) with a live HTML player floated over the stage (MediaOverlayLayer), tracking pan/zoom via the same world→screen transform as the existing text-edit overlay.pointer-eventstoggle), so Konva still drives select/drag/resize/z-order/lock with no changes toSelectToolor theTransformer.AssetKindgains"audio";importFilesclassifiesaudio/*and places a card (no bitmap/PDF decoding). The player resolves the public Storage URL at render time.parseEmbedUrl()normaliseswatch?v=/youtu.be/shorts/embedand Drivefile/d/<id>/open?id=links to canonical iframe URLs (unit-verified).assetStore.insertEmbed()drops a card at the viewport centre.AppMenu): import acceptsaudio/*; a new "Embed YouTube / Google Drive…" popover takes a URL with inline validation."embed"is wired throughshapeBounds/translateShape,ShapesLayer,TransformLayer, andSelectionInspector(theYShapeunion is exhaustive, sotscconfirms every site is handled).0003widens theassets.kindCHECK to allow'audio'.Sync / persistence
YEmbedis an ordinary Yjs shape, so it syncs over Supabase Realtime and persists in snapshots/IndexedDB automatically — no new sync plumbing. Each viewer controls their own playback (no shared transport position in this pass).Verification
pnpm -r typecheckpasses (all 5 packages).pnpm buildpasses.parseEmbedUrlunit-checked against watch/youtu.be/shorts/embed/Drive URLs and negative cases (non-YouTube/Drive → inline error).Manual (recommended before merge, needs Supabase configured)
.mp3→ card appears at centre; select it → HTML5 player plays; drag/resize/rotate/lock behave like an image; pan/zoom keeps the player pinned.watch?v=/youtu.beURL → video iframe embeds.Notes / out of scope
YEmbedlater.https://claude.ai/code/session_012m6DUY6q4Vk2WuUh9GtkpA
Generated by Claude Code