video.js icon indicating copy to clipboard operation
video.js copied to clipboard

video.js is huge

Open stratboy opened this issue 8 years ago • 11 comments

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

stratboy avatar Nov 30 '18 18:11 stratboy

👋 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.

welcome[bot] avatar Nov 30 '18 18:11 welcome[bot]

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

marguinbc avatar Nov 30 '18 19:11 marguinbc

I could, but is there any playback performance drawback, or polyfill to be used, in that case?

stratboy avatar Dec 01 '18 07:12 stratboy

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/).

gkatsev avatar Dec 01 '18 15:12 gkatsev

@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.

alexlopez-natgeo avatar Dec 10 '18 14:12 alexlopez-natgeo

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.

stratboy avatar Dec 10 '18 14:12 stratboy

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.

gkatsev avatar Dec 18 '18 16:12 gkatsev

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.

m16u31D avatar Aug 30 '19 18:08 m16u31D

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).

gkatsev avatar Aug 30 '19 19:08 gkatsev

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?

gbalduzzi avatar May 26 '20 08:05 gbalduzzi

125KB is minnified and gzipped.

gkatsev avatar Aug 06 '20 06:08 gkatsev