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

processCues doesn't recompute positions when container size changes #348

Open
kepstin opened this issue Feb 10, 2016 · 1 comment
Open

Comments

@kepstin
Copy link

kepstin commented Feb 10, 2016

I'm drawing cues into a container with a fluid size - it resizes as the browser window changes. I would like to redraw the cues in the correct positions following a browser resize.

Right now, if I simply call processCues() again following a window resize event, it does not update the cue positions; they're simply redrawn back in the same positions, which might be offscreen (if the window was made smaller) or simply misplaced or in the wrong size.

The positions do correctly update following the next cue change.

I'm thinking that this could be solved by storing the height/width of the paddedOverlay box (where?), and having the shouldCompute function return true if the current size doesn't match the stored size.

@radiantmediaplayer
Copy link

radiantmediaplayer commented Dec 5, 2016

This how we do it: we have an additional parameter (forceCompute) which we pass to processCues (it looks like WebVTT.processCues(window, activeCues, ccArea, forceCompute)). If set to true this setting will force shouldCompute to return true. In case we need to resize the caption display area we call processCues with forceCompute set to true. In case this is just an update (as in timeupdate for HTML5 video) but without resizing we pass forceCompute to false. There is probably a better way but it does the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants