@waveform-playlist/browser 15.3.2 → 15.3.4
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.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -1
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1575,6 +1575,12 @@ function createPeaksWorker() {
|
|
|
1575
1575
|
generate() {
|
|
1576
1576
|
return Promise.reject(new Error("Worker creation failed"));
|
|
1577
1577
|
},
|
|
1578
|
+
// Reports NOT terminated: CSP blocking is permanent for the page, so
|
|
1579
|
+
// recreating on every call would just re-attempt (and re-warn about)
|
|
1580
|
+
// Worker construction each time.
|
|
1581
|
+
isTerminated() {
|
|
1582
|
+
return false;
|
|
1583
|
+
},
|
|
1578
1584
|
terminate() {
|
|
1579
1585
|
}
|
|
1580
1586
|
};
|
|
@@ -1607,6 +1613,9 @@ function createPeaksWorker() {
|
|
|
1607
1613
|
pending.clear();
|
|
1608
1614
|
};
|
|
1609
1615
|
return {
|
|
1616
|
+
isTerminated() {
|
|
1617
|
+
return terminated;
|
|
1618
|
+
},
|
|
1610
1619
|
generate(params) {
|
|
1611
1620
|
if (terminated) return Promise.reject(new Error("Worker terminated"));
|
|
1612
1621
|
const messageId = String(++idCounter);
|
|
@@ -1649,7 +1658,7 @@ function useWaveformDataCache(tracks, baseScale) {
|
|
|
1649
1658
|
const subscribersByBufferRef = useRef8(/* @__PURE__ */ new WeakMap());
|
|
1650
1659
|
const pendingCountRef = useRef8(0);
|
|
1651
1660
|
const getWorker = useCallback12(() => {
|
|
1652
|
-
if (!workerRef.current) {
|
|
1661
|
+
if (!workerRef.current || workerRef.current.isTerminated()) {
|
|
1653
1662
|
workerRef.current = createPeaksWorker();
|
|
1654
1663
|
}
|
|
1655
1664
|
return workerRef.current;
|
|
@@ -1877,6 +1886,7 @@ var WaveformPlaylistProvider = ({
|
|
|
1877
1886
|
const playbackStartTimeRef = useRef9(0);
|
|
1878
1887
|
const audioStartPositionRef = useRef9(0);
|
|
1879
1888
|
const playbackEndTimeRef = useRef9(null);
|
|
1889
|
+
const suppressEngineStopMirrorRef = useRef9(false);
|
|
1880
1890
|
const scrollContainerRef = useRef9(null);
|
|
1881
1891
|
const isAutomaticScrollRef = useRef9(false);
|
|
1882
1892
|
const frameCallbacksRef = useRef9(/* @__PURE__ */ new Map());
|
|
@@ -2085,7 +2095,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2085
2095
|
const wasPlaying = isPlayingRef.current;
|
|
2086
2096
|
const resumePosition = currentTimeRef.current;
|
|
2087
2097
|
if (engineRef.current && wasPlaying) {
|
|
2098
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2088
2099
|
engineRef.current.stop();
|
|
2100
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2089
2101
|
stopAnimationFrameLoop();
|
|
2090
2102
|
pendingResumeRef.current = { position: resumePosition };
|
|
2091
2103
|
}
|
|
@@ -2185,6 +2197,14 @@ var WaveformPlaylistProvider = ({
|
|
|
2185
2197
|
}
|
|
2186
2198
|
}
|
|
2187
2199
|
});
|
|
2200
|
+
engine.on("stop", () => {
|
|
2201
|
+
if (suppressEngineStopMirrorRef.current) return;
|
|
2202
|
+
setIsPlaying(false);
|
|
2203
|
+
stopAnimationFrameLoop();
|
|
2204
|
+
const stoppedAt = engine.getCurrentTime();
|
|
2205
|
+
setCurrentTimeRefs(stoppedAt);
|
|
2206
|
+
setCurrentTime(stoppedAt);
|
|
2207
|
+
});
|
|
2188
2208
|
engine.setTracks(tracksWithState);
|
|
2189
2209
|
suppressTracksMirroring = false;
|
|
2190
2210
|
lastTracksVersionRef.current = engine.getState().tracksVersion;
|
|
@@ -2482,7 +2502,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2482
2502
|
if (isPlaying && animationFrameRef.current && engineRef.current) {
|
|
2483
2503
|
if (continuousPlay) {
|
|
2484
2504
|
const currentPos = currentTimeRef.current;
|
|
2505
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2485
2506
|
engineRef.current.stop();
|
|
2507
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2486
2508
|
stopAnimationLoop();
|
|
2487
2509
|
const timeNow = getAudioContextTime();
|
|
2488
2510
|
playbackStartTimeRef.current = timeNow;
|
|
@@ -2537,7 +2559,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2537
2559
|
const actualStartTime = startTime != null ? startTime : currentTimeRef.current;
|
|
2538
2560
|
playStartPositionRef.current = actualStartTime;
|
|
2539
2561
|
setCurrentTimeRefs(actualStartTime);
|
|
2562
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2540
2563
|
engineRef.current.stop();
|
|
2564
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2541
2565
|
engineRef.current.seek(actualStartTime);
|
|
2542
2566
|
stopAnimationLoop();
|
|
2543
2567
|
const startTimeNow = getAudioContextTime();
|
|
@@ -2652,7 +2676,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2652
2676
|
setCurrentTimeRefs(start);
|
|
2653
2677
|
setCurrentTime(start);
|
|
2654
2678
|
if (isPlaying && engineRef.current) {
|
|
2679
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2655
2680
|
engineRef.current.stop();
|
|
2681
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2656
2682
|
engineRef.current.seek(start);
|
|
2657
2683
|
engineRef.current.play(start);
|
|
2658
2684
|
}
|