JavascriptSubtitlesOctopus icon indicating copy to clipboard operation
JavascriptSubtitlesOctopus copied to clipboard

fix resize

Open turuslan opened this issue 3 years ago • 1 comments
trafficstars

changes:

  • fix "top/left changed" check.
    • was comparing style.top/style.left (string with pxsuffix) with number.
  • split "top/left changed" and "width/height changed" code.
    • top/left and width/height are 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.

turuslan avatar Feb 28 '22 06:02 turuslan

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.

dmitrylyzo avatar May 07 '22 20:05 dmitrylyzo