Skip to content

feat: let owners group videos into playlists that play in one embed - #8

Merged
its-gabo merged 1 commit into
mainfrom
gs_feat_add_option_to_group_videos_in_playlists
Nov 20, 2026
Merged

its-gabo merged 1 commit into
mainfrom
gs_feat_add_option_to_group_videos_in_playlists

Conversation

@its-gabo

Copy link
Copy Markdown
Owner

Summary

Owners can now group a library's videos into playlists and embed a whole playlist as one player. Viewers move between the videos with an episodes menu that shows each video's description and how much of it they watched. When a video ends, the next one starts by itself after a short countdown. A signed playlist URL covers every video in it, so a signed library needs only one signature per playlist.

Videos get a description, shown in the episodes menu. This PR also restyles the video sheet, moves playback security to its own Security tab, and makes the demo seed create a custom storage in its own bucket.

What owners see

  • Playlists tab. It lists the library's playlists with their video count, total duration and last change. New playlist asks for a title and an optional description, then opens the playlist.
  • Playlist sheet.
    • Videos. Drag a video by its handle (⠿) to change the order, or use the keyboard on a focused handle. Add video searches the library's videos that aren't in the playlist yet. Each change saves right away, and a failed save puts the old order back.
    • Notices. These show only when they matter. A red one appears when a video's upload or processing failed, so viewers skip it, and explains how to fix it. A neutral one appears while videos are still uploading or processing. Rows show Failed or Not ready yet badges.
    • Embed. The iframe code, with autoplay, start-muted and title options.
    • Edit. The pencil next to the close button edits the title and description.
  • Video sheet.
    • Edit. The pencil next to the close button edits the title and description. The description shows under the title.
    • Details. The headline figures (duration, resolution, size, format) are one strip, like the analytics totals. Qualities and dates follow as a list.
    • Thumbnail and Chapters. These use the same bordered style as Details. The thumbnail is a compact preview next to its source.
  • Player settings. A new Autoplay next video switch, on by default.
  • Security tab. Allowed sites and signed URLs moved here from the API tab, which now covers only keys and usage.
  • Activity log. New entries: "Created a playlist", "Updated a playlist", "Changed a playlist's videos" and "Deleted a playlist".

What viewers see

The playlist embed is at /embed/:libraryId/playlists/:playlistId. It accepts autoplay, muted, title, t, and v (the video to start with).

  • Episodes menu. It lists every video with a number, title and watched bar. The video playing is open, showing its poster with "Now playing" and its description. Hovering or focusing another video opens it, with a smooth height animation, and clicking plays it.
  • Next video.
    • A next button shows a preview of the next video on hover.
    • At the end of a video, a countdown card starts the next one after 5 seconds. Viewers can dismiss it, and the library's setting can turn it off.
  • Switching videos. The next video plays in the same player, so fullscreen and volume carry over. ?v= in the URL follows along.
  • Progress. Kept in the viewer's browser, because viewers are anonymous. A video resumes where the viewer left it, and plays from the start once they've watched 95% of it.
  • Skipped videos. Videos that aren't processed are left out until they are.

Changes

API

New endpoints, for members and for library API keys:

Member route Library API route Scope
GET …/libraries/:id/playlists GET /libraries/:id/playlists videos:read
POST …/libraries/:id/playlists POST /libraries/:id/playlists videos:manage
GET …/playlists/:playlistId GET /libraries/:id/playlists/:playlistId videos:read
PATCH …/playlists/:playlistId PATCH /libraries/:id/playlists/:playlistId videos:manage
PUT …/playlists/:playlistId/videos PUT /libraries/:id/playlists/:playlistId/videos videos:manage
DELETE …/playlists/:playlistId DELETE /libraries/:id/playlists/:playlistId videos:manage
POST /libraries/:id/playlists/:playlistId/playback-urls playback:sign

Public, under the library's playback rules:

Route Returns
GET /libraries/:id/playlists/:playlistId/embed The playlist's processed videos in order, each with its own URLs, plus the player settings
  • Bodies.

    • Create takes { title, description?, videoIds? }.
    • PUT …/videos takes { videoIds } and replaces the whole list in that order. An empty list removes every video.
    • A playlist holds at most 50 videos, each listed once.
    • Saving the same values again changes and records nothing.
  • Signed playback. A playlist is signed for playlist:<id>, so its signature can't play one of its videos on its own. The embed signs each video's URLs with the same key and expiry.

  • Errors.

    Status Code When
    404 playlist.not_found The playlist doesn't exist in this library
    422 playlist.video_not_in_library A video belongs to another library or doesn't exist
    422 validation.fail A blank or too long title, a video listed twice, or more than 50 videos
  • Video descriptions. PATCH …/videos/:videoId now takes { title?, description? }, and needs at least one. An empty or null description removes it. Videos and video embeds include description.

    • Activity: saving an unchanged title no longer adds a video.updated entry.
  • Player settings. These have a new autoplayNext field, which defaults to true for libraries saved before it existed.

    • Breaking: the dashboard's PUT …/player now requires autoplayNext. Only the web app calls it.
  • CORS. The library API now allows PUT. Before, browsers couldn't call the existing chapters and poster endpoints across origins.

  • Activity log. A new playlist resource type, and the playlist.created, playlist.updated, playlist.videos_updated and playlist.deleted actions. Playlists send no webhooks yet.

Migrations

0012_add_playlists_and_video_descriptions.sql

  • playlists. Belongs to one library, with a check against blank titles.
  • playlist_items. Stores each video's position in the playlist.
    • Both of its foreign keys include library_id, so the database rejects a video of another library.
    • Deleting a video removes it from its playlists. Deleting a playlist leaves its videos in the library.
  • videos.description. New nullable column.
  • Defaults and checks. Updates the default player_settings to include autoplayNext, and allows the new activity actions and resource type.

Shared

  • Limits. PLAYLIST_LIMITS, and VIDEO_FIELD_LIMITS.DESCRIPTION_MAX_LENGTH.
  • Schemas. playlistTitleSchema, playlistDescriptionSchema, playlistVideoIdsSchema and videoDescriptionSchema.
  • Embed paths. playlistEmbedPath, and the v embed query key.
  • UI. The shared form renderer supports a textarea field type.

Web

  • Player. VideoPlayer takes a playlist. New components: PlayerEpisodesMenu, PlayerNextEpisodeButton and PlayerUpNext.
    • useHlsPlayback loads a new source into the same <video> and can start it as soon as it loads.
  • Embed.
    • New PlaylistEmbedPlayer, with useWatchProgress for progress kept in localStorage.
    • Video and playlist embeds share one loader and an EmbedCodeSection.
  • Dashboard.
    • New playlist components: the table, sheet, edit dialog and videos editor (with @dnd-kit).
    • New VideoEditDialog, VideoFacts, FigureStrip and VideoThumbnail.
    • The Playlists and Security routes.
    • The video and playlist tables indent their first column like the other tables.
  • Dependencies. @dnd-kit/core, sortable, modifiers and utilities, pinned. The lockfile adds only these.
  • Translations. English and Polish for everything new.

Seed

  • Storage. The seed creates an acme-media-videos bucket on the local S3 server, then an "Acme Media bucket" storage with the path template videos/{year}/{month}/{libraryId}/{videoId}. It's assigned to "Online courses" before anything is uploaded.
  • Playlist. The lessons get descriptions and an "OpenStream basics" playlist.

@its-gabo its-gabo self-assigned this Nov 20, 2026
@its-gabo
its-gabo merged commit 3d8aacc into main Nov 20, 2026
1 check passed
@its-gabo
its-gabo deleted the gs_feat_add_option_to_group_videos_in_playlists branch November 22, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant