Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor(plugin-video): allow native html5 video media types #4059

Open
oellers opened this issue Sep 2, 2024 · 5 comments
Open

editor(plugin-video): allow native html5 video media types #4059

oellers opened this issue Sep 2, 2024 · 5 comments

Comments

@oellers
Copy link

oellers commented Sep 2, 2024

Current state

  • Supports YouTube, Vimeo and WikimediaCommons media sources

Goal

  • Allow native html5 video media types
    • video/mp4
    • video/webm
    • video/ogg

Draft

Discussion (UX)

  • Currently, media sources from youtube, vimeo and wikimedia commons are validated by regex;
  • There are several challenges with validating arbitrary remote urls

How can remote media types be validated?

  1. Extension validation (soft validation)
    Url indicates a typical media extension type (e.g. .mp4, .webm, .ogg for html5 video elements).
    Disadvantages:

    • No real validation of media type
    • Other URLs serving media would be invalid (if this is the only type of validation);
      workarounds by suffixing with a valid media type, e.g. in the query parameter (bad ux)
  2. Header validation
    Retrieve the content-type response header from the URL.
    A (cors) request to get the headers of the URL could be initiated.
    Disadvantages:

    • A frontend request will only work based on regular CORS restrictions (appropriate Access-Control-Allow-Origin headers), there's a good chance this won't work in most cases.
      • Alternative: Headers could be validated with a backend proxy route, e.g. compared to mathpix proxy, but this would introduce cross-origin dependencies

How do others deal with this situation?

H5P

Conclusion

Follow up question
What are the opinions of the Serlo maintainers on that matter? I could prepare a PR based on the decision.

@elbotho
Copy link
Member

elbotho commented Sep 4, 2024

Thank you @oellers for your super thorough suggestion! We will talk about it next week and get back to you.

@kulla
Copy link
Member

kulla commented Sep 9, 2024

Thank you @oellers for the issue + PR. It shows that integrating video files will be easy to implement. Currently we are planning a new plugin for interactive videos (see https://2024-09-06-demo-interactive-video.vercel.app/). For this we need to change our video player anyways since we will need one which support chapter markers (do you know one)? Then we plan to work on this issue as well and to add support for native html5 video files.

@elbotho
Copy link
Member

elbotho commented Sep 9, 2024

Also a quick question @oellers: Do you have examples / use cases where those files would be hosted?
It also has upsides for us to restrict where videos can be embedded from.

@oellers
Copy link
Author

oellers commented Sep 9, 2024

For this we need to change our video player anyways since we will need one which support chapter markers (do you know one)?

Like WebVTT chapters?
VidStack.io could be of interest.
We used video.js, mediaelement.js and paella player for older projects.

You might also want to inspire yourself from our list of video annotation tools, e.g. in terms of features, that we gathered in the Opencast Annotation Tool Community Meetings.

Also a quick question @oellers: Do you have examples / use cases where those files would be hosted? It also has upsides for us to restrict where videos can be embedded from.

Literally anywhere (if this will be a generalized feature), that's kind of the challenge of validation here, unless you want to introduce some kind of custom allowlists for deployments;

Examples:
https://media.w3.org/2010/05/sintel/trailer.mp4
https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

Edit: If you change the player, I'd actually would love to see HLS/DASH-Streaming as well =)
(though the interesting part will be the stream authorization then for my specific use case)

@elbotho
Copy link
Member

elbotho commented Dec 19, 2024

unless you want to introduce some kind of custom allowlists for deployments

Unfortunately due to privacy constrains we basically have to.

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

No branches or pull requests

3 participants