Skip to content

feat: add video embed page and route group restructure#3327

Open
daniellefrappier18 wants to merge 24 commits into
mainfrom
daniellef/11123-feat-video-embed-page
Open

feat: add video embed page and route group restructure#3327
daniellefrappier18 wants to merge 24 commits into
mainfrom
daniellef/11123-feat-video-embed-page

Conversation

@daniellefrappier18
Copy link
Copy Markdown
Contributor

@daniellefrappier18 daniellefrappier18 commented May 11, 2026

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/11123

Description (What does it do?)

  • Adds a /video/[id]/embed route under a new (embed) route group for embedding individual OCW videos in iframes. The page validates the resource is a playable video (HLS, MP4, or YouTube) before rendering.
  • Removes the VideoPlaylistPage feature flag entirely, cleaning it up from all existing pages that previously gated on it.
  • Restructures the app router by introducing a (site) route group that wraps all existing pages with the site header, footer, and global styles, keeping the root layout minimal so the embed route can opt out of the site UI.
  • Adds (embed)/not-found.tsx for iframe-appropriate 404s (no home button) and (embed)/error.tsx for non-404 runtime errors, both without site UI
  • Adds (site)/[...unmatched]/page.tsx catch-all so unmatched site routes (e.g. /bad-route) correctly resolve to (site)/not-found.tsx with header/footer.
  • Adds generateMetadata to the embed page so the iframe has a meaningful <title> and is marked noindex; falls back to "Video" for missing or non-embeddable resources.

Screenshots (if appropriate):

  • Desktop screenshots
  • Mobile width screenshots

Video Embed Page with valid id (not YouTube)
http://open.odl.local:8062/video/115203/embed
Screenshot 2026-05-12 at 9 50 07 AM
Screenshot 2026-05-12 at 9 51 17 AM

Video Embed 404 Page with NON valid id (not YouTube)
http://open.odl.local:8062/video/000/embed

Screenshot 2026-05-12 at 3 10 04 PM

Video Embed Page with a valid YouTube id
Screenshot 2026-05-12 at 1 12 57 PM

Video Embed Page with non-404 error
I just added throw new Error("test error") temporarily to VideoEmbedPage.tsx to simulate

const VideoEmbedPage: React.FC<VideoEmbedPageProps> = ({ videoId }) => { throw new Error("test error") // ← here, remove after testing const { data: resource, isLoading } = useLearningResourcesDetail(videoId) ...

Screenshot 2026-05-12 at 2 48 53 PM

Regular non video embed page that doesn't exist
http://open.odl.local:8062/this-does-not-exist

Screenshot 2026-05-12 at 3 34 46 PM

Existing site route page
http://open.odl.local:8062/search?q=
Screenshot 2026-05-12 at 11 34 51 AM

How can this be tested?

  • Navigate to a valid video embed URL (e.g. /video/[id]/embed). The video player renders full-viewport with no with no header/footer and the tab title is that of the video plus the | MIT Learn appendix
  • Navigate to /video/000/embed (nonexistent ID). The embed 404 page renders with no header/footer or Home button, and the tab title is "Not Found | MIT Learn"
  • Navigate to /this-does-not-exist or another page that will 404. It shows custom 404 page with site header and footer and have the title "Not Found | MIT Learn"
  • Navigate to any existing site route (e.g. /search) — header and footer still present, no regression
  • Trigger a non-404 error on an embed page (e.g. temporarily throw new Error("test") at the top of VideoEmbedPage.tsx). The error page renders full-viewport with no header/footer and no Home button, and the tab title is that of the video plus the | MIT Learn appendix

Additional Context

@daniellefrappier18 daniellefrappier18 force-pushed the daniellef/11123-feat-video-embed-page branch from 7a76aa0 to d7b8490 Compare May 11, 2026 20:09
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@daniellefrappier18 daniellefrappier18 changed the title add video embed page and route group restructure feat: add video embed page and route group restructure May 11, 2026
@daniellefrappier18 daniellefrappier18 marked this pull request as ready for review May 12, 2026 12:38
Copilot AI review requested due to automatic review settings May 12, 2026 12:38

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 67 changed files in this pull request and generated no new comments.

@daniellefrappier18 daniellefrappier18 added the Needs Review An open Pull Request that is ready for review label May 13, 2026
@ChristopherChudzicki ChristopherChudzicki self-assigned this May 15, 2026
Copy link
Copy Markdown
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well! I tried out some iframes with the embed page, too:

Image

I left some comments and suggestions. Main requested change is around the appzi link.

Comment thread frontends/main/src/app-pages/ErrorPage/ErrorPageTemplate.tsx Outdated
Comment thread frontends/main/src/app/(embed)/video/[id]/embed/page.test.tsx
Comment thread frontends/main/src/app/(embed)/video/[id]/embed/page.tsx Outdated
Comment thread frontends/main/src/app/(embed)/video/[id]/embed/page.tsx Outdated
Comment thread frontends/main/src/app/(embed)/video/[id]/embed/page.tsx Outdated
Comment thread frontends/main/src/app/layout.tsx Outdated
Comment on lines -18 to -20
export const metadata = {
title: "Error",
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was confused why this was removed.

For posterity... error.tsx becomes an ErrorBoundary, and error boundaries are always client components. https://nextjs.org/docs/app/getting-started/error-handling#nested-error-boundaries

And client components can't set metadata, so this was useless all along.

not-found.tsx is NOT converted into an error boundary by nextjs, it's explicitly triggered via notFound or missng routes on server render, so it's different.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be dead code so I was just cleaning it up. Is there a reason to keep this that I'm not aware of?

Comment thread frontends/main/src/app/(embed)/video/[id]/embed/page.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants