frontend icon indicating copy to clipboard operation
frontend copied to clipboard

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

Open oellers opened this issue 1 year ago • 5 comments

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.

oellers avatar Sep 02 '24 09:09 oellers

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

elbotho avatar Sep 04 '24 16:09 elbotho

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.

kulla avatar Sep 09 '24 11:09 kulla

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.

elbotho avatar Sep 09 '24 12:09 elbotho

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)

oellers avatar Sep 09 '24 12:09 oellers

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

Unfortunately due to privacy constrains we basically have to.

elbotho avatar Dec 19 '24 15:12 elbotho