DEV Community

Jaimie Carter
Jaimie Carter

Posted on

videojs

Being a beginner and having no idea what I’m doing: I’ve been wondering just how hard it is to write a library to manipulate HTML video tags. I look at videojs and I’m baffled before I even begin.

  1. Is it really necessary to have that much JavaScript, when all you’re doing is fine tuning those tags?
  2. How do you make sense of what is there, anyway? It just looks like it is spaghetti
  3. Where do you start? Thoughts?

Top comments (4)

Collapse
 
philnash profile image
Phil Nash

It all depends on what you're trying to do. Videojs looks like a comprehensive solution for a number of things that you may (or may not) care about when showing video on the web. It's also extensible with options to add skins and plugins. It probably deals with a bunch of cross browser issues, wrapping up native classes and so on.

If you are just looking to replace the controls of a video component with something you want to build yourself, then you definitely don't need all of that.

I'd start with the HTMLVideoElement (and it's parent HTMLMediaElement and see what you can achieve with the API available. Start with controlling playback and showing progress and see how you go. Then decide what you want to attack next.

Collapse
 
jamonjamon profile image
Jaimie Carter

Thanks, Phil. I did see the MediaElement one and it did look simpler. So I'll take that as a win if I could glean that! I'll have a more in-depth look.

Collapse
 
philnash profile image
Phil Nash

The HTMLMediaElement is direct API access to what a <video> element can do through JavaScript. Ultimately videojs will be accessing that API too.

Thread Thread
 
jamonjamon profile image
Jaimie Carter

Ah sorry, I was talking about MediaElement.js