video.js is huge
Hi, I just noticed that my defaults.js (the file where I concatenate all my scripts), is very big. So I looked at single files weights, and saw that video.js, minified, is almost 500kb!
It's really, really huge for a single script that only give a service and isn't the whole app. Is there a way to have it lighter? Is there a light version somewhere? I just need it for a background video... 500k are definitely too much for only that.
Thank you
👋 Thanks for opening your first issue here! 👋
If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.
Video.js is a complete, fully functioning HTML 5 video player. If all you need is a background video you could use the HTML5 <video> element with the playsinline and muted attributes, a little JavaScript and CSS. For example, W3Schools has this example: https://www.w3schools.com/howto/howto_css_fullscreen_video.asp
I could, but is there any playback performance drawback, or polyfill to be used, in that case?
Video.js definitely isn't small. This is because it does quite a lot. The biggest parts are Video.js are the segmented video format support, caption support, and controls. We're working on making it easier to disable the parts that you don't need. If you just have an mp4 to play, you may be better off with just a video element, otherwise, you can try using one of the alternative builds of Video.js which exclude segmented video format support or caption support (https://unpkg.com/[email protected]/dist/alt/).
@stratboy, if is 500kb, is because something is wrong for that flow, our player is 340kb built on top of videojs 7.3 and includes a vr player, playlist functionality, ads, and a custom skin, try Gzip and minify your code for production, also you might want to check code splitting techniques if you don't need the player on the first payload.
Just check the download version: the minified one is almost 500kb. Yes I can gzip, but the thing is still too much for my needs. I eneded up with native video, and for things more complicated, I found another good free library.
Sorry to hear that you weren't able to use Video.js. Hopefully, sometime in January we'll have a better answer for this. In the meanwhile, I'm going to close this issue.
hi , is there today(September/2019) a light version of videojs?
Sorry to hear that you weren't able to use Video.js. Hopefully, sometime in January we'll have a better answer for this. In the meanwhile, I'm going to close this issue.
The latest Video.js pre-release (7.6.4) is 12KB minified/gzipped smaller.
As for a "light" version. It depends on which features you want. If you want HLS support in all browsers, no. If you don't care about HLS, you can grab the "core" builds, which exclude it (https://unpkg.com/browse/[email protected]/dist/alt/).
Minified gzipped video.js is around 125KB, without VHS it is 57KB and without vttjs (if you don't care about captions) is 51KB. At some point, we'll have a better writeup about this and why it's "big" (it isn't any bigger than comparable players).
I downloaded npm latest version ( 7.7.5 ), and the minified file (/dist/video.min.js) is 468Kb, how do you reach 125KB?
EDIT: I just noticed that the cdn minified version ( https://vjs.zencdn.net/7.7.6/video.min.js ) is 127Kb. Why the NPM version is so much bigger?
125KB is minnified and gzipped.