@bendyline/squisq-react 2.3.3 → 2.4.1

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.
package/README.md CHANGED
@@ -125,6 +125,10 @@ Interactive mount:
125
125
 
126
126
  For headless capture, add `renderMode: true`, then await
127
127
  `handle.renderAPI` before calling `seekTo()` or reading render metadata.
128
+ `seekTo()` resolves only after React has committed the requested visual time,
129
+ CSS animations have been positioned, active video has produced its sought
130
+ frame, and one final paint opportunity has completed. `getRenderedTime()`
131
+ returns the timeline time represented by the committed DOM.
128
132
  TypeScript hosts can import `MountOptions` and `SquisqPlayerHandle` from the
129
133
  package root.
130
134
 
@@ -483,7 +483,12 @@ import {
483
483
  VIEWPORT_PRESETS
484
484
  } from "@bendyline/squisq/doc";
485
485
  function useDocPlayback(script, currentTime, options = {}) {
486
- const { viewport = VIEWPORT_PRESETS.landscape, theme, onSeek } = options;
486
+ const {
487
+ viewport = VIEWPORT_PRESETS.landscape,
488
+ theme,
489
+ onSeek,
490
+ useAudioSegmentTiming = true
491
+ } = options;
487
492
  const blocks = useMemo2(() => {
488
493
  if (!script?.blocks) {
489
494
  return [];
@@ -497,10 +502,10 @@ function useDocPlayback(script, currentTime, options = {}) {
497
502
  resolvedTheme
498
503
  );
499
504
  if (hasTemplates) {
500
- const audioSegments = script.audio?.segments?.map((seg) => ({
505
+ const audioSegments = useAudioSegmentTiming ? script.audio?.segments?.map((seg) => ({
501
506
  startTime: seg.startTime,
502
507
  duration: seg.duration
503
- }));
508
+ })) : void 0;
504
509
  const expanded = expandDocBlocks(flatBlocks, {
505
510
  audioSegments,
506
511
  viewport,
@@ -524,7 +529,8 @@ function useDocPlayback(script, currentTime, options = {}) {
524
529
  script?.persistentLayers,
525
530
  script?.customTemplates,
526
531
  viewport,
527
- theme
532
+ theme,
533
+ useAudioSegmentTiming
528
534
  ]);
529
535
  const currentBlock = useMemo2(() => getBlockAtTime(blocks, currentTime), [blocks, currentTime]);
530
536
  const currentBlockIndex = useMemo2(