Conversation
8580acc to
c04240c
Compare
ChristopherChudzicki
left a comment
There was a problem hiding this comment.
I could upload videos but noticed a few issues.
|
|
||
| // --- MIT LEARN MP4 VIDEOS --- | ||
| if ( | ||
| hostname === "learn.mit.edu" && |
There was a problem hiding this comment.
Suggestion: I think we should do VIDEO_HOST_WHITELIST since Ferdi/Matt indicated we need to support OVS videos (+their cloudflare URLs).
Request: Either switch to the whitelist (we'd need a new env var; They are added in ol-infrastructure. See, for example, https://github.com/mitodl/ol-infrastructure/pull/3977/changes) or at least use a check that isn't hard-coded, like new URL(process.env.NEXT_PUBLIC_ORIGIN).host so that this works with rc/local hosts.
There was a problem hiding this comment.
Can you check now please?
| /> | ||
| {isVideoUrl(src) ? ( | ||
| <video src={src} controls title={caption}> | ||
| <track kind="captions" /> |
There was a problem hiding this comment.
Here and in MediaEmbedViewer, a track without a src is useless. We should remove it.
Request: Could you also look into sharing the display between these two, unless there's a good reason not to? The display will get more complicated as we add tracks, etc
There was a problem hiding this comment.
I have introduced env variable now
| {/* Empty track required by jsx-a11y/media-has-caption */} | ||
| <track kind="captions" /> |
There was a problem hiding this comment.
Better to just suppress the linting error than having an HTML element with no function.
We will need to add proper captions eventually, though.
ChristopherChudzicki
left a comment
There was a problem hiding this comment.
Minor comments + we need to make a decision about https://github.com/mitodl/mit-learn/pull/2968/changes#r2848090299
| process.env.NEXT_PUBLIC_CLOUDFRONT_DOMAIN || | ||
| "https://d3tsb3m56iwvoq.cloudfront.net", | ||
| ), | ||
| ).hostname.replace("www.", "") && |
There was a problem hiding this comment.
A few questions:
- Any reason for the www replacement? IMO it makes sense to just compare against the env var.
- NEXT_PUBLIC_CLOUDFRONT_DOMAIN is a new env var, right? If adding a new env var anyway, I think it makes sense to just add the NEXT_PUBLIC_VIDEO_WHITELIST approach
ensureProtocolseems unnecessary...- NEXT_PUBLIC_ORIGIN is an origin, so it has a protocol
- NEXT_PUBLIC_CLOUDFRONT_DOMAIN ... couldn't we use the origin? (That's what your fallback does) or preferable VIDEO_ORIGINS_WHITELIST
| "https://d3tsb3m56iwvoq.cloudfront.net", | ||
| ), | ||
| ).hostname.replace("www.", "") && | ||
| parsed.pathname.toLowerCase().endsWith(".m3u8") |
There was a problem hiding this comment.
Native video element has pretty mixed support for .m3u8... This won't work on firefox as-is. To support m3u8, I believe we need something like VideoJS or hls.js, though I haven't researched it too much.
So we need to either:
- Add real support for m3u8 here
- or use OVS's embed endpoint with an iframe, at least for now,
- Or only support mp4s coming from learn. This seems not particularly useful. Seems like main discussions now are around supporting OVS videos.
Somewhat separately: From the plugin's perspective, I don't think it makes sense for some domains to support one type of video (learn, mp4), and the other domains to support only another type (ovs cloudfront, m3u8).
There was a problem hiding this comment.
Somewhat separately: From the plugin's perspective, I don't think it makes sense for some domains to support one type of video (learn, mp4), and the other domains to support only another type (ovs cloudfront, m3u8).
We need detail about what domain will support what videos or atleast we need to be sure about the total number of formats we need to support regardless of domains
There was a problem hiding this comment.
We need detail about what domain will support what videos o
I don't think we need to know which domains support which video types. That's up to the domains.
- We need to know which domains we trust
- We need tow know which video types our tech supports
Those are separate issues, so it makes sense to separate the checks.
if (!we_trust_the_domain) {return or error}
if (mp4 or m3u8) { our_custom_player}
otherwise, iframe embedding
459aa85 to
934fec8
Compare
| inert={editable} | ||
| /> | ||
| </MediaContainer> | ||
| <MediaDisplay src={src} caption={caption} /> |
There was a problem hiding this comment.
Bug: The refactored MediaDisplay component no longer applies the inert attribute, making embedded iframes interactive in editor mode, which was previously prevented.
Severity: MEDIUM
Suggested Fix
Add an editable boolean prop to the MediaDisplay component. Pass the editable state from MediaEmbedNodeView.tsx to MediaDisplay. Inside MediaDisplay, conditionally apply the inert={editable} attribute to the iframe element to restore the intended non-interactive behavior during editing.
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/MediaEmbedNodeView.tsx#L191
Potential issue: The refactoring of media embed rendering into the `MediaDisplay`
component resulted in the loss of the `inert={editable}` attribute on iframes.
Previously, this attribute made embedded media non-interactive when the editor was in an
editable state. Now, because the `MediaDisplay` component is not aware of the editor's
`editable` status, embedded iframes (e.g., YouTube, Vimeo) are interactive during
editing. This is a functional regression that allows unintended user interaction with
embeds while editing content.
Did we get this right? 👍 / 👎 to inform future reviews.
3f23c0d to
2236825
Compare
2236825 to
d1d6977
Compare
ChristopherChudzicki
left a comment
There was a problem hiding this comment.
@ahtesham-quraish Let's talk more in the channel about this. We really need transcripts and cover images for the urgent use-case, so we are looking at a different route.
| "https://d3tsb3m56iwvoq.cloudfront.net", | ||
| ), | ||
| ).hostname.replace("www.", "") && | ||
| parsed.pathname.toLowerCase().endsWith(".m3u8") |
There was a problem hiding this comment.
We need detail about what domain will support what videos o
I don't think we need to know which domains support which video types. That's up to the domains.
- We need to know which domains we trust
- We need tow know which video types our tech supports
Those are separate issues, so it makes sense to separate the checks.
if (!we_trust_the_domain) {return or error}
if (mp4 or m3u8) { our_custom_player}
otherwise, iframe embedding
| ".video-js": { | ||
| width: "100%", | ||
| height: "100%", | ||
| borderRadius: "6px", |
There was a problem hiding this comment.
Pretty minor comment, but I'm not sure if any of this .video-js css is necessary/doing anything.
The height is being overridden to 0px, then videojs does some padding shenanigans to make it look good. And, perhaps related to that, the border radius isn't doing anything:
And videojs already sets width: 100%
| // eslint-disable-next-line jsx-a11y/media-has-caption | ||
| <video src={src} controls title={caption}> | ||
| Your browser does not support the video tag. | ||
| </video> |
There was a problem hiding this comment.
Can we use the same player for both mp4 and m3u8? I don't think there's any reason they need to be separate... Nice if they can be handled the same way.
I think vieojs supports using multiple playback "tech" https://videojs.org/guides/tech/
There was a problem hiding this comment.
I have made the change you can check now please.
85c240f to
7c29a91
Compare

What are the relevant tickets?
https://mitodl.slack.com/archives/C0A16A1K1PE/p1771620781758439
Description (What does it do?)
We need to provide support for embedding the mp4 videos like we do for youtube and vimeo.
Screenshots (if appropriate):
How can this be tested?
For testing you need to paste the following url https://learn.mit.edu/media/shorts/1a8026f6e4cfefbf/1a8026f6e4cfefbf.mp4
It should embed the video tag.
Additional Context