Skip to content

hardcode allowing to embed videos from ovs#2987

Merged
ChristopherChudzicki merged 2 commits intomainfrom
cc/embed-from-ovs
Feb 26, 2026
Merged

hardcode allowing to embed videos from ovs#2987
ChristopherChudzicki merged 2 commits intomainfrom
cc/embed-from-ovs

Conversation

@ChristopherChudzicki
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki commented Feb 26, 2026

What are the relevant tickets?

None

Description (What does it do?)

This PR adds video.odl.mit.edu as a potential media embedding source for the New editor

Screenshots (if appropriate):

Screenshot 2026-02-26 at 2 13 54 PM

How can this be tested?

  1. As a user with article-editing permissions (e.g., a superuser) visit /news/new
  2. Add a title to your article (it's required)
  3. In the article body, click Insert -> Video
  4. Paste https://video.odl.mit.edu/videos/5444a783abb94d1fb773ff390d21a603/embed/ into the article editor.
  5. View the video, try playing it. Change screensize. Save article, publish article.

Comment on lines +48 to +49
if (hostname === "video.odl.mit.edu") {
return url
Copy link

Choose a reason for hiding this comment

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

Bug: The convertToEmbedUrl function returns video.odl.mit.edu URLs as-is, but they require transformation to an embed format (e.g., adding /embed/) to work in an iframe.
Severity: HIGH

Suggested Fix

Modify the convertToEmbedUrl function to handle video.odl.mit.edu URLs. The logic should extract the video ID from the path and construct a new URL in the correct embed format, https://video.odl.mit.edu/videos/{VIDEO_ID}/embed/, similar to how YouTube and Vimeo URLs are transformed.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
frontends/main/src/page-components/TiptapEditor/extensions/node/MediaEmbed/lib.ts#L48-L49

Potential issue: The `convertToEmbedUrl` function identifies URLs from
`video.odl.mit.edu` but returns them without modification. For these videos to be
embeddable in an iframe, the URL must be transformed into the format
`https://video.odl.mit.edu/videos/{VIDEO_ID}/embed/`. The current implementation will
pass the original, non-embeddable URL directly to the iframe's `src` attribute. This
will result in a broken or blank video embed for any user attempting to embed a video
from this service using a standard video page URL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

People will paste the embed video, we may end up allowing m3u8 directly also subsequently, so let's leave this as is

}

// --- ODL VIDEO EMBED ---
if (hostname === "video.odl.mit.edu") {
Copy link
Contributor Author

@ChristopherChudzicki ChristopherChudzicki Feb 26, 2026

Choose a reason for hiding this comment

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

Might change / better organization this validation. See https://github.com/mitodl/mit-learn/pull/2968/changes#r2860467411 for discussion.

is an effort to support video embeddings directly in the article editor without iframes. We need this soon, though, and we need it with transcripts and cover images, so we are going to use the OVS video embed page for now.

Copy link
Contributor Author

@ChristopherChudzicki ChristopherChudzicki Feb 26, 2026

Choose a reason for hiding this comment

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

I guess I should mention that the thumbnail and captions aren't actually working at https://video.odl.mit.edu/videos/5444a783abb94d1fb773ff390d21a603/embed/ (The data exists, but isn't hooked up to videojs quite right), but Matt is working on fixing that and it seems like a much smaller lift than adding m3u8+Captions+cover images here.

@gumaerc gumaerc self-assigned this Feb 26, 2026
@gumaerc
Copy link
Contributor

gumaerc commented Feb 26, 2026

I wasn't able to get this working. Firstly, the article-viewer feature flag needs to be enabled in Posthog to be able to see published articles, so I had to turn that on. Even after that though, I wasn't able to get it to recognize that I was inserting a video with the blob syntax:

2026-02-26.15-53-46.mp4

I rebuilt all my containers before this on this branch, so it should have everything it needs in theory.

Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

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

After getting the correct embedding URL (https://video.odl.mit.edu/videos/5444a783abb94d1fb773ff390d21a603/embed/) I was able to successfully embed the video. It wouldn't play back in the article editor, but after publishing I was able to click on it and play it back, resize the window, etc. and everything worked fine.

@ChristopherChudzicki ChristopherChudzicki merged commit a025312 into main Feb 26, 2026
14 checks passed
@ChristopherChudzicki ChristopherChudzicki deleted the cc/embed-from-ovs branch February 26, 2026 21:08
@odlbot odlbot mentioned this pull request Feb 26, 2026
1 task
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.

2 participants