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

video.js is huge #5632

Closed
stratboy opened this issue Nov 30, 2018 · 11 comments
Closed

video.js is huge #5632

stratboy opened this issue Nov 30, 2018 · 11 comments

Comments

@stratboy
Copy link

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

@welcome
Copy link

welcome bot commented Nov 30, 2018

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

@marguinbc
Copy link
Contributor

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

@stratboy
Copy link
Author

stratboy commented Dec 1, 2018

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

@gkatsev
Copy link
Member

gkatsev commented Dec 1, 2018

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/video.js@7.3.0/dist/alt/).

@alexlopez-natgeo
Copy link

alexlopez-natgeo commented Dec 10, 2018

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

@stratboy
Copy link
Author

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.

@gkatsev
Copy link
Member

gkatsev commented Dec 18, 2018

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 gkatsev closed this as completed Dec 18, 2018
@m16u31D
Copy link

m16u31D commented Aug 30, 2019

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.

@gkatsev
Copy link
Member

gkatsev commented Aug 30, 2019

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/video.js@7.6.0/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).

@gbalduzzi
Copy link

gbalduzzi commented May 26, 2020

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?

@gkatsev
Copy link
Member

gkatsev commented Aug 6, 2020

125KB is minnified and gzipped.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants