Arnavion / libjass

Renders ASS subs in the browser.
Apache License 2.0
174 stars 29 forks source link

When playing preroll ads, sometimes the text appears very small #108

Closed DoomTay closed 6 years ago

DoomTay commented 6 years ago

Sample set

This happens with a simple implementation of videojs-contrib-ads (heisenbug.html) and with videojs-vast-vpaid (heisenbug2.html), though the latter case is much, much rarer.

I noticed that when this happens, the style of span elements for subtitle lines are missing the font attribute. It seems that something about how both plugins set up ad playback interferes with span styling somehow, even though only one of them makes use of videojs-contrib-ads/

I'm not sure how to trace this further, but because it involves span styling, it seems this is a libjass issue.

Arnavion commented 6 years ago

As the documentation says

After the renderer fires its ready event, libjass.renderers.WebRenderer.resize must be called to initialize its size before starting the clock.

However videojs-ass is starting the clock before calling resize, thus WebRenderer.preRender is getting called before its scaleX and scaleY properties have been initialized. videojs-ass needs to fix this.

(Edit: videojs -> videojs-ass)