@waveform-playlist/browser 9.5.2 → 10.1.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.ts +76 -0
- package/dist/index.js +158 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5217 -4669
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { DragMoveEvent } from '@dnd-kit/abstract';
|
|
|
7
7
|
import { DragOperation } from '@dnd-kit/abstract';
|
|
8
8
|
import { DragStartEvent } from '@dnd-kit/abstract';
|
|
9
9
|
import { EngineState } from '@waveform-playlist/engine';
|
|
10
|
+
import { FadeConfig } from '@waveform-playlist/media-element-playout';
|
|
10
11
|
import { Gain } from 'tone';
|
|
11
12
|
import { InputNode } from 'tone';
|
|
12
13
|
import { MediaElementPlayout } from '@waveform-playlist/media-element-playout';
|
|
@@ -774,6 +775,8 @@ export declare interface MediaElementDataContextValue {
|
|
|
774
775
|
barWidth: number;
|
|
775
776
|
barGap: number;
|
|
776
777
|
progressBarWidth: number;
|
|
778
|
+
fadeIn?: FadeConfig;
|
|
779
|
+
fadeOut?: FadeConfig;
|
|
777
780
|
}
|
|
778
781
|
|
|
779
782
|
/**
|
|
@@ -804,6 +807,8 @@ export declare interface MediaElementPlaylistProps {
|
|
|
804
807
|
onAnnotationUpdate?: OnAnnotationUpdateFn;
|
|
805
808
|
/** Custom playhead render function. Receives position, color, and animation refs for smooth 60fps animation. */
|
|
806
809
|
renderPlayhead?: RenderPlayheadFunction;
|
|
810
|
+
/** Show fade in/out overlays on the waveform. Defaults to false. */
|
|
811
|
+
showFades?: boolean;
|
|
807
812
|
className?: string;
|
|
808
813
|
}
|
|
809
814
|
|
|
@@ -858,6 +863,16 @@ declare interface MediaElementPlaylistProviderProps {
|
|
|
858
863
|
progressBarWidth?: number;
|
|
859
864
|
/** Callback when annotations are changed (drag, edit, etc.) */
|
|
860
865
|
onAnnotationsChange?: (annotations: AnnotationData[]) => void;
|
|
866
|
+
/**
|
|
867
|
+
* AudioContext for Web Audio routing (fades, effects).
|
|
868
|
+
* When provided, audio routes through Web Audio nodes:
|
|
869
|
+
* HTMLAudioElement → MediaElementSourceNode → fadeGain → volumeGain → destination
|
|
870
|
+
*
|
|
871
|
+
* Without this, playback uses HTMLAudioElement directly (no fades or effects).
|
|
872
|
+
* Each provider instance should use its own AudioContext or share one —
|
|
873
|
+
* createMediaElementSource() is called once per audio element.
|
|
874
|
+
*/
|
|
875
|
+
audioContext?: AudioContext;
|
|
861
876
|
/** Callback when audio is ready */
|
|
862
877
|
onReady?: () => void;
|
|
863
878
|
children: ReactNode;
|
|
@@ -878,6 +893,10 @@ export declare interface MediaElementTrackConfig {
|
|
|
878
893
|
waveformData: WaveformDataObject;
|
|
879
894
|
/** Track name for display */
|
|
880
895
|
name?: string;
|
|
896
|
+
/** Fade in configuration (requires audioContext on provider) */
|
|
897
|
+
fadeIn?: FadeConfig;
|
|
898
|
+
/** Fade out configuration (requires audioContext on provider) */
|
|
899
|
+
fadeOut?: FadeConfig;
|
|
881
900
|
}
|
|
882
901
|
|
|
883
902
|
/**
|
|
@@ -920,6 +939,8 @@ export declare interface MediaElementWaveformProps {
|
|
|
920
939
|
scrollActiveContainer?: 'nearest' | 'all';
|
|
921
940
|
/** Custom playhead render function. Receives position, color, and animation refs for smooth 60fps animation. */
|
|
922
941
|
renderPlayhead?: RenderPlayheadFunction;
|
|
942
|
+
/** Show fade in/out overlays on the waveform. Defaults to false. */
|
|
943
|
+
showFades?: boolean;
|
|
923
944
|
className?: string;
|
|
924
945
|
}
|
|
925
946
|
|
|
@@ -1146,6 +1167,8 @@ declare interface PlaylistStateContextValue {
|
|
|
1146
1167
|
selectedTrackId: string | null;
|
|
1147
1168
|
loopStart: number;
|
|
1148
1169
|
loopEnd: number;
|
|
1170
|
+
/** Whether playback continues past the end of loaded audio */
|
|
1171
|
+
indefinitePlayback: boolean;
|
|
1149
1172
|
}
|
|
1150
1173
|
|
|
1151
1174
|
/**
|
|
@@ -1968,6 +1991,55 @@ export declare const useMediaElementData: () => MediaElementDataContextValue;
|
|
|
1968
1991
|
|
|
1969
1992
|
export declare const useMediaElementState: () => MediaElementStateContextValue;
|
|
1970
1993
|
|
|
1994
|
+
export declare function useOutputMeter(options?: UseOutputMeterOptions): UseOutputMeterReturn;
|
|
1995
|
+
|
|
1996
|
+
/**
|
|
1997
|
+
* Hook for monitoring master output levels
|
|
1998
|
+
*
|
|
1999
|
+
* Connects an AudioWorklet meter processor to the Destination node for
|
|
2000
|
+
* real-time output level monitoring. Computes sample-accurate peak and
|
|
2001
|
+
* RMS via the meter worklet — no transient is missed.
|
|
2002
|
+
*
|
|
2003
|
+
* IMPORTANT: Uses getGlobalContext() from playout to ensure the meter
|
|
2004
|
+
* is created on the same AudioContext as the audio engine. Tone.js's
|
|
2005
|
+
* getContext()/getDestination() return the DEFAULT context, which is
|
|
2006
|
+
* replaced when getGlobalContext() calls setContext() on first audio init.
|
|
2007
|
+
*/
|
|
2008
|
+
export declare interface UseOutputMeterOptions {
|
|
2009
|
+
/**
|
|
2010
|
+
* Number of channels to meter.
|
|
2011
|
+
* Default: 2 (stereo output)
|
|
2012
|
+
*/
|
|
2013
|
+
channelCount?: number;
|
|
2014
|
+
/**
|
|
2015
|
+
* How often to update the levels (in Hz).
|
|
2016
|
+
* Default: 60 (60fps)
|
|
2017
|
+
*/
|
|
2018
|
+
updateRate?: number;
|
|
2019
|
+
/**
|
|
2020
|
+
* Whether audio is currently playing. When this transitions to false,
|
|
2021
|
+
* all levels (current, peak, RMS) and smoothed state are reset to zero.
|
|
2022
|
+
* Without this, the browser's tail-time optimization stops calling the
|
|
2023
|
+
* worklet's process() when no audio flows, leaving the last non-zero
|
|
2024
|
+
* levels frozen in state.
|
|
2025
|
+
* Default: false
|
|
2026
|
+
*/
|
|
2027
|
+
isPlaying?: boolean;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
export declare interface UseOutputMeterReturn {
|
|
2031
|
+
/** Per-channel peak output levels (0-1) */
|
|
2032
|
+
levels: number[];
|
|
2033
|
+
/** Per-channel held peak levels (0-1) */
|
|
2034
|
+
peakLevels: number[];
|
|
2035
|
+
/** Per-channel RMS output levels (0-1) */
|
|
2036
|
+
rmsLevels: number[];
|
|
2037
|
+
/** Reset all held peak levels to 0 */
|
|
2038
|
+
resetPeak: () => void;
|
|
2039
|
+
/** Error from meter setup (worklet load failure, context issues, etc.) */
|
|
2040
|
+
error: Error | null;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
1971
2043
|
export declare const usePlaybackAnimation: () => PlaybackAnimationContextValue;
|
|
1972
2044
|
|
|
1973
2045
|
/**
|
|
@@ -2245,6 +2317,9 @@ declare interface WaveformPlaylistProviderProps {
|
|
|
2245
2317
|
* Use this during progressive loading to avoid rebuilding the engine for
|
|
2246
2318
|
* each track — flip to false when all tracks are ready for a single build. */
|
|
2247
2319
|
deferEngineRebuild?: boolean;
|
|
2320
|
+
/** Disable automatic stop when the cursor reaches the end of the longest
|
|
2321
|
+
* track. Useful for DAW-style recording beyond existing audio. */
|
|
2322
|
+
indefinitePlayback?: boolean;
|
|
2248
2323
|
children: ReactNode;
|
|
2249
2324
|
}
|
|
2250
2325
|
|
|
@@ -2256,6 +2331,7 @@ declare interface WaveformPlaylistTheme {
|
|
|
2256
2331
|
selectedWaveOutlineColor: WaveformColor;
|
|
2257
2332
|
selectedWaveFillColor: WaveformColor;
|
|
2258
2333
|
selectedTrackControlsBackground: string;
|
|
2334
|
+
selectedTrackBackground: string;
|
|
2259
2335
|
timeColor: string;
|
|
2260
2336
|
timescaleBackgroundColor: string;
|
|
2261
2337
|
playheadColor: string;
|