Skip to content

Skip course video intro/outro after first play per session#443

Merged
simonhamp merged 3 commits into
mainfrom
course-video-preview
Jul 24, 2026
Merged

Skip course video intro/outro after first play per session#443
simonhamp merged 3 commits into
mainfrom
course-video-preview

Conversation

@simonhamp

Copy link
Copy Markdown
Member

What & why

Course lesson videos open with a branded intro (~9s) and close with an outro (~10s). Sitting through them on every lesson is tedious. This shows the intro once per session, then gets the viewer straight to the content.

  • The first video a user plays in a session runs in full (intro included).
  • Every subsequent video that session starts at 9s (skips the intro) and stops 10s before the end (skips the outro).

Marking is on play, not on page view — opening a lesson without playing it doesn't burn the one-time intro.

How

  • LessonShow reads a course_video_played session flag at mount into a $skipIntroOutro property. A #[Renderless] markVideoPlayed() action sets the flag.
  • courseVideo Alpine component (resources/js/alpine/courseVideo.js) drives the Vimeo player:
    • On the first play (when not skipping), calls $wire.markVideoPlayed() so later videos skip.
    • Intro is trimmed natively via the Vimeo #t=9s URL fragment; the outro via the Vimeo Player SDK, pausing at duration − 10s (with a guard so short videos aren't left with a negative window).
  • The Vimeo Player SDK loads from Vimeo's CDN — no new npm dependency.
  • The iframe is wrapped in wire:ignore so Livewire re-renders (e.g. Mark Complete) don't reload the player.

Testing

  • 4 new feature tests in CourseContentTest.php cover: first video not skipping, markVideoPlayed recording the session, a preset session skipping, and the end-to-end play-then-skip flow.
  • Full CourseContentTest suite passes (23 tests, 46 assertions); Pint clean; npm run build bundles the new module.

🤖 Generated with Claude Code

simonhamp and others added 3 commits July 23, 2026 20:09
Show the branded intro (first 9s) once per session: the first video a
user plays runs in full, then every later video that session starts at
9s and stops 10s before the end.

A session flag on LessonShow drives whether to skip; a new courseVideo
Alpine component uses the Vimeo Player SDK to detect the first play,
mark the session, and pause at duration-10s for the outro.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add a right-hand course outline column on the lesson page (matching the
  left nav width) and drop the module titles from the sidebar Masterclass group
- Rename "Draft" content pills to "Coming Soon"
- Hide the "content coming soon" banner once a playable video is shown
- Remove Free/Pro pills and completion dots from the outline and index list
- Show draft lessons to everyone as Coming Soon, clickable only by admins;
  skip inaccessible lessons in prev/next and count only published lessons
  toward progress
- Right-align the Next button; strike through completed lessons in the
  outline and add a hover title to clipped lesson names

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix the intro/outro skip: the Vimeo player was held on a reactive Alpine
  property, whose proxy broke the SDK's WeakMap lookups ("Unknown player").
  Keep the player in a closure and let the SDK build the iframe; the intro
  skip moves to setCurrentTime
- Toggle play/pause with the space bar anywhere on the lesson page
- Add markdown lesson notes: a MarkdownEditor field in the admin (like blog
  articles) plus a notes column, rendered beneath the Prev/Next row via
  CommonMark in a fixed-width left-aligned column
- Hide unpublished modules from non-admins and block access to their
  lessons; label unpublished modules "Draft"
- Remove the Free/Pro labels from the lesson page

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simonhamp
simonhamp marked this pull request as ready for review July 24, 2026 12:51
@simonhamp
simonhamp merged commit f957b4b into main Jul 24, 2026
2 checks passed
@simonhamp
simonhamp deleted the course-video-preview branch July 24, 2026 12:52
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