@waveform-playlist/browser 13.1.0 → 13.1.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/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -45,7 +45,8 @@ interface TrackState$1 {
|
|
|
45
45
|
interface FrameData {
|
|
46
46
|
/** Raw engine time (for state/logic — NOT for visual positioning). */
|
|
47
47
|
readonly time: number;
|
|
48
|
-
/**
|
|
48
|
+
/** Visually-aligned time for DOM positioning: engine.getAudibleTime() while
|
|
49
|
+
* playing (matches speaker output), raw time when resting. */
|
|
49
50
|
readonly visualTime: number;
|
|
50
51
|
readonly sampleRate: number;
|
|
51
52
|
readonly samplesPerPixel: number;
|
|
@@ -55,8 +56,8 @@ interface PlaybackAnimationContextValue {
|
|
|
55
56
|
currentTime: number;
|
|
56
57
|
currentTimeRef: React__default.RefObject<number>;
|
|
57
58
|
/**
|
|
58
|
-
* Visually-aligned playback time (
|
|
59
|
-
*
|
|
59
|
+
* Visually-aligned playback time (engine.getAudibleTime() while playing;
|
|
60
|
+
* raw resting time otherwise). Kept current by the animation loop during playback
|
|
60
61
|
* and by pause/seek/stop paths when stopped. Read from this for any visual
|
|
61
62
|
* positioning that should match the audible output.
|
|
62
63
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,8 @@ interface TrackState$1 {
|
|
|
45
45
|
interface FrameData {
|
|
46
46
|
/** Raw engine time (for state/logic — NOT for visual positioning). */
|
|
47
47
|
readonly time: number;
|
|
48
|
-
/**
|
|
48
|
+
/** Visually-aligned time for DOM positioning: engine.getAudibleTime() while
|
|
49
|
+
* playing (matches speaker output), raw time when resting. */
|
|
49
50
|
readonly visualTime: number;
|
|
50
51
|
readonly sampleRate: number;
|
|
51
52
|
readonly samplesPerPixel: number;
|
|
@@ -55,8 +56,8 @@ interface PlaybackAnimationContextValue {
|
|
|
55
56
|
currentTime: number;
|
|
56
57
|
currentTimeRef: React__default.RefObject<number>;
|
|
57
58
|
/**
|
|
58
|
-
* Visually-aligned playback time (
|
|
59
|
-
*
|
|
59
|
+
* Visually-aligned playback time (engine.getAudibleTime() while playing;
|
|
60
|
+
* raw resting time otherwise). Kept current by the animation loop during playback
|
|
60
61
|
* and by pause/seek/stop paths when stopped. Read from this for any visual
|
|
61
62
|
* positioning that should match the audible output.
|
|
62
63
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4180,12 +4180,7 @@ var WaveformPlaylistProvider = ({
|
|
|
4180
4180
|
return ((_b2 = audioStartPositionRef.current) != null ? _b2 : 0) + elapsed;
|
|
4181
4181
|
}, []);
|
|
4182
4182
|
const toVisualTime = (0, import_react24.useCallback)((rawTime) => {
|
|
4183
|
-
|
|
4184
|
-
const audioCtx = (0, import_playout6.getGlobalAudioContext)();
|
|
4185
|
-
const latency = "outputLatency" in audioCtx ? audioCtx.outputLatency : 0;
|
|
4186
|
-
const lookAhead = (_b2 = (_a2 = engineRef.current) == null ? void 0 : _a2.lookAhead) != null ? _b2 : 0;
|
|
4187
|
-
const visual = rawTime - latency - lookAhead;
|
|
4188
|
-
return Number.isFinite(visual) ? Math.max(0, visual) : 0;
|
|
4183
|
+
return Number.isFinite(rawTime) ? Math.max(0, rawTime) : 0;
|
|
4189
4184
|
}, []);
|
|
4190
4185
|
const setCurrentTimeRefs = (0, import_react24.useCallback)(
|
|
4191
4186
|
(rawTime) => {
|
|
@@ -4205,14 +4200,10 @@ var WaveformPlaylistProvider = ({
|
|
|
4205
4200
|
frameCallbacksRef.current.delete(id);
|
|
4206
4201
|
}, []);
|
|
4207
4202
|
const startAnimationLoop = (0, import_react24.useCallback)(() => {
|
|
4208
|
-
const audioCtx = (0, import_playout6.getGlobalAudioContext)();
|
|
4209
4203
|
const updateTime = () => {
|
|
4210
|
-
var _a2, _b2;
|
|
4211
4204
|
const time = getPlaybackTime();
|
|
4212
4205
|
currentTimeRef.current = time;
|
|
4213
|
-
const
|
|
4214
|
-
const lookAhead = (_b2 = (_a2 = engineRef.current) == null ? void 0 : _a2.lookAhead) != null ? _b2 : 0;
|
|
4215
|
-
const visualRaw = time - latency - lookAhead;
|
|
4206
|
+
const visualRaw = engineRef.current ? engineRef.current.getAudibleTime() : time;
|
|
4216
4207
|
const visualTime = Number.isFinite(visualRaw) ? Math.max(0, visualRaw) : 0;
|
|
4217
4208
|
visualTimeRef.current = visualTime;
|
|
4218
4209
|
const sr = sampleRateRef.current;
|