JavascriptSubtitlesOctopus
JavascriptSubtitlesOctopus copied to clipboard
fix resize
changes:
- fix "top/left changed" check.
- was comparing
style.top/style.left(string withpxsuffix) with number.
- was comparing
- split "top/left changed" and "width/height changed" code.
top/leftandwidth/heightare not related.
fixes:
- canvas became empty because of unnecessary resize.
- open videojs.html.
- pause when subtitles are visible.
- resize window by 1 pixel, video/canvas size is not changed.
- subtitles disappear.
Jellyfin's Render Ahead mode doesn't redraw the frame and is forced to resize the canvas according to the rendered viewport, so the browser scales the result itself.
So the fix works for non-cached draws (at least wasm-blend), but not for our mode.
This works for our mode (and wasm-blend) - 3840x2160 frame (canvas size) can be drawn on 1280x720 canvas (style size).
But I'm not sure about using styles for the canvas that isn't driven by the video element.
UPD: My version doesn't seem to work with self.pixelRatio != 1.
And for wasm-blend with these options:
prescaleFactor: 8,
prescaleHeightLimit: 2160*2
UPD: It turns out that when using the buttons in the Titan example to change the player size, we need to update the stylized size. I ended up with this.