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

Add an event to signal that the player was resized using the API e.g. player.dimensions()

Open marguinbc opened this issue 9 years ago • 5 comments

Description

When using the API to resize the player, ie: player.dimensions(width, height), there is no event triggered to notify one that the player has been resized. This need surfaced when working on a third-party plugin that needed to be informed of the player size changing so that underlying VPAID ads could resize in response.

I propose we ad a vjs-player-resize event that is triggered when the player dimensions are changed so that developers can listen for this event to resize VPAID ads, overlays, position controls, etc. in response to the dimensions changing.

marguinbc avatar Sep 25 '17 13:09 marguinbc

Based on previous discussion and event naming conventions it should be playerresize. And yes, we definitely need to bring it back.

gkatsev avatar Sep 25 '17 15:09 gkatsev

Thoughts on triggering this event after fullscreenchanges as well?

alex-barstow avatar Nov 21 '17 17:11 alex-barstow

@videojs/core-committers Any thoughts on this issue?

ldayananda avatar Dec 07 '17 21:12 ldayananda

So, I think the immediate next step for this is to have player dimension methods (like width, height, dimensions) trigger a playerresize event when they're called. I would say to add it below this line: https://github.com/videojs/video.js/blob/e187585748ac930851f02704937c7c8a87858f17/src/js/player.js#L719 Main problem with that would be that we'd get 2 playerresize if you call player.dimensions(200, 200) because each one calls dimension(), maybe that's ok and we can just fix it later. Going to mark this as a help wanted and first timers only

gkatsev avatar Dec 08 '17 19:12 gkatsev

I'd like to work on this issue.

sivapalan avatar Dec 10 '17 07:12 sivapalan