@bendyline/squisq-react 2.11.17 → 2.11.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3167,6 +3167,28 @@ function DocPlayerContent({
3167
3167
  });
3168
3168
  }, [onCaptionsToggle]);
3169
3169
  const hasCaptions = doc.captions && doc.captions.phrases.length > 0;
3170
+ const [frameSize, setFrameSize] = useState6(null);
3171
+ useEffect7(() => {
3172
+ const frame = containerRef.current;
3173
+ if (!frame || renderMode || !hasCaptions) return;
3174
+ const measure = () => {
3175
+ const width = frame.offsetWidth;
3176
+ const height = frame.offsetHeight;
3177
+ if (width <= 0 || height <= 0) return;
3178
+ setFrameSize(
3179
+ (prev) => prev && prev.width === width && prev.height === height ? prev : { width, height }
3180
+ );
3181
+ };
3182
+ measure();
3183
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
3184
+ observer?.observe(frame);
3185
+ window.addEventListener("resize", measure);
3186
+ return () => {
3187
+ observer?.disconnect();
3188
+ window.removeEventListener("resize", measure);
3189
+ };
3190
+ }, [renderMode, hasCaptions, isLinearMode, isDashboardMode]);
3191
+ const captionViewport = !renderMode && frameSize ? { ...activeViewport, ...frameSize } : activeViewport;
3170
3192
  const segmentTitleMap = useMemo5(() => buildSegmentTitleMap(doc), [doc]);
3171
3193
  const playbackState = useMemo5(
3172
3194
  () => ({
@@ -3652,11 +3674,11 @@ function DocPlayerContent({
3652
3674
  captions: doc.captions,
3653
3675
  currentTime,
3654
3676
  enabled: captionsEnabled && (renderMode || isPlaying || currentTime > 0),
3655
- fontSize: Math.min(34, Math.max(16, Math.round(activeViewport.height * 0.026))),
3677
+ fontSize: Math.min(34, Math.max(16, Math.round(captionViewport.height * 0.026))),
3656
3678
  captionStyle: activeCaptionStyle,
3657
3679
  captionPosition,
3658
3680
  theme: effectiveTheme,
3659
- viewport: activeViewport
3681
+ viewport: captionViewport
3660
3682
  }
3661
3683
  ),
3662
3684
  isDebugMode && /* @__PURE__ */ jsxs6(
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  formatTime,
16
16
  resolveDocPlayerAppearance,
17
17
  useMediaClipDurations
18
- } from "./chunk-622IA3KB.js";
18
+ } from "./chunk-CB2MCXJ6.js";
19
19
  import {
20
20
  PaginatedDocView
21
21
  } from "./chunk-PSAO2CTF.js";
@@ -12,7 +12,7 @@ import {
12
12
  MediaClipLayer,
13
13
  SocialCaptionOverlay,
14
14
  formatTime
15
- } from "../chunk-622IA3KB.js";
15
+ } from "../chunk-CB2MCXJ6.js";
16
16
  import "../chunk-2VSD55NT.js";
17
17
  import "../chunk-SVVPYDV3.js";
18
18
  import "../chunk-TT6ENR6T.js";