-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
feat: player resize event #4800
Conversation
Trigger a playerresize event when the player is resized using the API Fixes videojs#4629
Allows us to avoid triggering the resize event twice when setting both width and height at once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally forgot that we had skipListeners
feature. Good catch!
Given that we're adding a new event, this would be a |
Also, thanks for adding tests! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done!
Use ResizeObserver when available for better and more performant resizing information, otherwise, fall back to a throttled resize event on an iframe that's the size of the player. Allows a video.js user to disable this by setting resizeManager: false as an option since the component will not be initialized. Add a debounce util. This reverts #4800 (e0ed0b5) because we end up getting two playerresize events with the dimension methods now.
Description
Fixes #4629, and also handles multi-dimensional resizing correctly. I.e.
playerresize
event is only triggered once when width and height is changed at once (usingComponent#dimensions
).Specific Changes proposed
Trigger a
playerresize
event inPlayer#dimension
ifPlayer.isReady_
andskipListeners
is falsy.skipListeners
is added as an optional parameter to the following methods:Player#width
,Player#height
, andPlayer#dimension
. This parameter can be used to skip theplayerresize
event trigger.Requirements Checklist