@waveform-playlist/browser 10.3.0 → 11.0.0
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 -12
- package/dist/index.d.ts +4 -12
- package/dist/index.js +22 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
import { ThemeProvider } from "styled-components";
|
|
67
67
|
import {
|
|
68
68
|
createToneAdapter,
|
|
69
|
-
getGlobalAudioContext as
|
|
69
|
+
getGlobalAudioContext as getGlobalAudioContext4
|
|
70
70
|
} from "@waveform-playlist/playout";
|
|
71
71
|
import { PlaylistEngine } from "@waveform-playlist/engine";
|
|
72
72
|
import {
|
|
@@ -719,11 +719,11 @@ function useClipDragHandlers({
|
|
|
719
719
|
tracks,
|
|
720
720
|
onTracksChange,
|
|
721
721
|
samplesPerPixel,
|
|
722
|
-
sampleRate,
|
|
723
722
|
engineRef,
|
|
724
723
|
isDraggingRef,
|
|
725
724
|
snapSamplePosition
|
|
726
725
|
}) {
|
|
726
|
+
const { sampleRate } = usePlaylistData();
|
|
727
727
|
const snapSamplePositionRef = React.useRef(snapSamplePosition);
|
|
728
728
|
snapSamplePositionRef.current = snapSamplePosition;
|
|
729
729
|
const originalClipStateRef = React.useRef(null);
|
|
@@ -882,12 +882,13 @@ function useClipDragHandlers({
|
|
|
882
882
|
|
|
883
883
|
// src/hooks/useAnnotationDragHandlers.ts
|
|
884
884
|
import React2 from "react";
|
|
885
|
+
import { getGlobalAudioContext } from "@waveform-playlist/playout";
|
|
885
886
|
var LINK_THRESHOLD = 0.01;
|
|
886
887
|
function useAnnotationDragHandlers({
|
|
887
888
|
annotations,
|
|
888
889
|
onAnnotationsChange,
|
|
889
890
|
samplesPerPixel,
|
|
890
|
-
sampleRate,
|
|
891
|
+
sampleRate = getGlobalAudioContext().sampleRate,
|
|
891
892
|
duration,
|
|
892
893
|
linkEndpoints
|
|
893
894
|
}) {
|
|
@@ -1086,7 +1087,8 @@ function useDragSensors(options = {}) {
|
|
|
1086
1087
|
import { useCallback as useCallback7 } from "react";
|
|
1087
1088
|
import { calculateSplitPoint, canSplitAt } from "@waveform-playlist/engine";
|
|
1088
1089
|
var useClipSplitting = (options) => {
|
|
1089
|
-
const { tracks,
|
|
1090
|
+
const { tracks, engineRef } = options;
|
|
1091
|
+
const { sampleRate } = usePlaylistData();
|
|
1090
1092
|
const { currentTimeRef } = usePlaybackAnimation();
|
|
1091
1093
|
const { selectedTrackId } = usePlaylistState();
|
|
1092
1094
|
const splitClipAt = useCallback7(
|
|
@@ -1111,7 +1113,7 @@ var useClipSplitting = (options) => {
|
|
|
1111
1113
|
engine.splitClip(track.id, clip.id, snappedSplitSample);
|
|
1112
1114
|
return true;
|
|
1113
1115
|
},
|
|
1114
|
-
[tracks, options,
|
|
1116
|
+
[tracks, options, engineRef, sampleRate]
|
|
1115
1117
|
);
|
|
1116
1118
|
const splitClipAtPlayhead = useCallback7(() => {
|
|
1117
1119
|
var _a;
|
|
@@ -1269,10 +1271,9 @@ function useAnnotationKeyboardControls({
|
|
|
1269
1271
|
continuousPlay = false,
|
|
1270
1272
|
enabled = true,
|
|
1271
1273
|
scrollContainerRef,
|
|
1272
|
-
samplesPerPixel,
|
|
1273
|
-
sampleRate,
|
|
1274
1274
|
onPlay
|
|
1275
1275
|
}) {
|
|
1276
|
+
const { samplesPerPixel, sampleRate } = usePlaylistData();
|
|
1276
1277
|
const activeIndex = useMemo3(() => {
|
|
1277
1278
|
if (!activeAnnotationId) return -1;
|
|
1278
1279
|
return annotations.findIndex((a) => a.id === activeAnnotationId);
|
|
@@ -2648,7 +2649,7 @@ function useTrackDynamicEffects() {
|
|
|
2648
2649
|
import { useState as useState10, useCallback as useCallback13 } from "react";
|
|
2649
2650
|
import {
|
|
2650
2651
|
getUnderlyingAudioParam,
|
|
2651
|
-
getGlobalAudioContext
|
|
2652
|
+
getGlobalAudioContext as getGlobalAudioContext2
|
|
2652
2653
|
} from "@waveform-playlist/playout";
|
|
2653
2654
|
|
|
2654
2655
|
// src/utils/wavEncoder.ts
|
|
@@ -2748,7 +2749,7 @@ function useExportWav() {
|
|
|
2748
2749
|
if (mode === "individual" && (trackIndex === void 0 || trackIndex < 0 || trackIndex >= tracks.length)) {
|
|
2749
2750
|
throw new Error("Invalid track index for individual export");
|
|
2750
2751
|
}
|
|
2751
|
-
const sampleRate =
|
|
2752
|
+
const sampleRate = getGlobalAudioContext2().sampleRate;
|
|
2752
2753
|
let totalDurationSamples = 0;
|
|
2753
2754
|
for (const track of tracks) {
|
|
2754
2755
|
for (const clip of track.clips) {
|
|
@@ -3429,7 +3430,7 @@ function useWaveformDataCache(tracks, baseScale) {
|
|
|
3429
3430
|
// src/hooks/useDynamicTracks.ts
|
|
3430
3431
|
import { useState as useState12, useCallback as useCallback16, useRef as useRef12, useEffect as useEffect8 } from "react";
|
|
3431
3432
|
import { createTrack as createTrack2, createClipFromSeconds as createClipFromSeconds2 } from "@waveform-playlist/core";
|
|
3432
|
-
import { getGlobalAudioContext as
|
|
3433
|
+
import { getGlobalAudioContext as getGlobalAudioContext3 } from "@waveform-playlist/playout";
|
|
3433
3434
|
function getSourceName(source) {
|
|
3434
3435
|
var _a, _b, _c, _d, _e;
|
|
3435
3436
|
if (source instanceof File) {
|
|
@@ -3480,7 +3481,7 @@ function useDynamicTracks() {
|
|
|
3480
3481
|
}, []);
|
|
3481
3482
|
const addTracks = useCallback16((sources) => {
|
|
3482
3483
|
if (sources.length === 0) return;
|
|
3483
|
-
const audioContext =
|
|
3484
|
+
const audioContext = getGlobalAudioContext3();
|
|
3484
3485
|
const placeholders = sources.map((source) => ({
|
|
3485
3486
|
track: createTrack2({ name: `${getSourceName(source)} (loading...)`, clips: [] }),
|
|
3486
3487
|
source
|
|
@@ -3738,7 +3739,7 @@ var WaveformPlaylistProvider = ({
|
|
|
3738
3739
|
const prevTracksRef = useRef14([]);
|
|
3739
3740
|
const samplesPerPixelRef = useRef14(initialSamplesPerPixel);
|
|
3740
3741
|
const sampleRateRef = useRef14(
|
|
3741
|
-
typeof AudioContext !== "undefined" ?
|
|
3742
|
+
typeof AudioContext !== "undefined" ? getGlobalAudioContext4().sampleRate : 48e3
|
|
3742
3743
|
);
|
|
3743
3744
|
const { timeFormat, setTimeFormat, formatTime: formatTime2 } = useTimeFormat();
|
|
3744
3745
|
const zoom = useZoomControls({ engineRef, initialSamplesPerPixel });
|
|
@@ -6722,7 +6723,6 @@ var MediaElementPlaylist = ({
|
|
|
6722
6723
|
annotations,
|
|
6723
6724
|
onAnnotationsChange: handleAnnotationUpdate,
|
|
6724
6725
|
samplesPerPixel,
|
|
6725
|
-
sampleRate,
|
|
6726
6726
|
duration,
|
|
6727
6727
|
linkEndpoints: linkEndpointsProp
|
|
6728
6728
|
});
|
|
@@ -7028,7 +7028,7 @@ var KeyboardShortcuts = ({
|
|
|
7028
7028
|
annotations = false,
|
|
7029
7029
|
additionalShortcuts = []
|
|
7030
7030
|
}) => {
|
|
7031
|
-
const { tracks, samplesPerPixel,
|
|
7031
|
+
const { tracks, samplesPerPixel, playoutRef, duration } = usePlaylistData();
|
|
7032
7032
|
const {
|
|
7033
7033
|
annotations: annotationList,
|
|
7034
7034
|
linkEndpoints,
|
|
@@ -7038,7 +7038,6 @@ var KeyboardShortcuts = ({
|
|
|
7038
7038
|
const { setAnnotations, setActiveAnnotationId, scrollContainerRef, play } = usePlaylistControls();
|
|
7039
7039
|
const { splitClipAtPlayhead } = useClipSplitting({
|
|
7040
7040
|
tracks,
|
|
7041
|
-
sampleRate,
|
|
7042
7041
|
samplesPerPixel,
|
|
7043
7042
|
engineRef: playoutRef
|
|
7044
7043
|
});
|
|
@@ -7066,8 +7065,6 @@ var KeyboardShortcuts = ({
|
|
|
7066
7065
|
linkEndpoints,
|
|
7067
7066
|
continuousPlay,
|
|
7068
7067
|
scrollContainerRef,
|
|
7069
|
-
samplesPerPixel,
|
|
7070
|
-
sampleRate,
|
|
7071
7068
|
onPlay: play,
|
|
7072
7069
|
enabled: annotations && annotationList.length > 0
|
|
7073
7070
|
});
|
|
@@ -7210,7 +7207,6 @@ var ClipInteractionProvider = ({
|
|
|
7210
7207
|
tracks,
|
|
7211
7208
|
onTracksChange: onTracksChange != null ? onTracksChange : NOOP_TRACKS_CHANGE,
|
|
7212
7209
|
samplesPerPixel,
|
|
7213
|
-
sampleRate,
|
|
7214
7210
|
engineRef: playoutRef,
|
|
7215
7211
|
isDraggingRef,
|
|
7216
7212
|
snapSamplePosition
|