@waveform-playlist/browser 13.1.2 → 13.1.3
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 +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -224,6 +224,13 @@ declare const usePlaybackAnimation: () => PlaybackAnimationContextValue;
|
|
|
224
224
|
declare const usePlaylistState: () => PlaylistStateContextValue;
|
|
225
225
|
declare const usePlaylistControls: () => PlaylistControlsContextValue;
|
|
226
226
|
declare const usePlaylistData: () => PlaylistDataContextValue;
|
|
227
|
+
/**
|
|
228
|
+
* Like {@link usePlaylistData} but returns `null` instead of throwing when there
|
|
229
|
+
* is no WaveformPlaylistProvider ancestor. Use this in hooks/components that may
|
|
230
|
+
* also run in the MediaElement path (MediaElementPlaylistProvider), where the
|
|
231
|
+
* WebAudio playlist context is absent.
|
|
232
|
+
*/
|
|
233
|
+
declare const usePlaylistDataOptional: () => PlaylistDataContextValue | null;
|
|
227
234
|
|
|
228
235
|
interface MediaElementTrackConfig {
|
|
229
236
|
/** Audio source URL or Blob URL */
|
|
@@ -824,6 +831,14 @@ interface UseAnnotationKeyboardControlsOptions {
|
|
|
824
831
|
scrollContainerRef?: React.RefObject<HTMLDivElement | null>;
|
|
825
832
|
/** Optional: callback to start playback at a time with optional duration */
|
|
826
833
|
onPlay?: (startTime: number, duration?: number) => void;
|
|
834
|
+
/**
|
|
835
|
+
* Pixels-per-sample for auto-scroll positioning. Falls back to the
|
|
836
|
+
* WaveformPlaylistProvider context when omitted (WebAudio path). Pass
|
|
837
|
+
* explicitly when used outside that provider (e.g. the MediaElement path).
|
|
838
|
+
*/
|
|
839
|
+
samplesPerPixel?: number;
|
|
840
|
+
/** Sample rate for auto-scroll positioning. Falls back to context. */
|
|
841
|
+
sampleRate?: number;
|
|
827
842
|
}
|
|
828
843
|
/**
|
|
829
844
|
* Hook for keyboard-based annotation navigation and boundary editing
|
|
@@ -856,7 +871,7 @@ interface UseAnnotationKeyboardControlsOptions {
|
|
|
856
871
|
* });
|
|
857
872
|
* ```
|
|
858
873
|
*/
|
|
859
|
-
declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId, onAnnotationsChange, onActiveAnnotationChange, duration, linkEndpoints, continuousPlay, enabled, scrollContainerRef, onPlay, }: UseAnnotationKeyboardControlsOptions): {
|
|
874
|
+
declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId, onAnnotationsChange, onActiveAnnotationChange, duration, linkEndpoints, continuousPlay, enabled, scrollContainerRef, onPlay, samplesPerPixel: samplesPerPixelProp, sampleRate: sampleRateProp, }: UseAnnotationKeyboardControlsOptions): {
|
|
860
875
|
moveStartBoundary: (delta: number) => void;
|
|
861
876
|
moveEndBoundary: (delta: number) => void;
|
|
862
877
|
selectPrevious: () => void;
|
|
@@ -1850,4 +1865,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
|
|
|
1850
1865
|
bits: 8 | 16;
|
|
1851
1866
|
}>;
|
|
1852
1867
|
|
|
1853
|
-
export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramCanvasRegistration, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
|
|
1868
|
+
export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramCanvasRegistration, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistDataOptional, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
|
package/dist/index.d.ts
CHANGED
|
@@ -224,6 +224,13 @@ declare const usePlaybackAnimation: () => PlaybackAnimationContextValue;
|
|
|
224
224
|
declare const usePlaylistState: () => PlaylistStateContextValue;
|
|
225
225
|
declare const usePlaylistControls: () => PlaylistControlsContextValue;
|
|
226
226
|
declare const usePlaylistData: () => PlaylistDataContextValue;
|
|
227
|
+
/**
|
|
228
|
+
* Like {@link usePlaylistData} but returns `null` instead of throwing when there
|
|
229
|
+
* is no WaveformPlaylistProvider ancestor. Use this in hooks/components that may
|
|
230
|
+
* also run in the MediaElement path (MediaElementPlaylistProvider), where the
|
|
231
|
+
* WebAudio playlist context is absent.
|
|
232
|
+
*/
|
|
233
|
+
declare const usePlaylistDataOptional: () => PlaylistDataContextValue | null;
|
|
227
234
|
|
|
228
235
|
interface MediaElementTrackConfig {
|
|
229
236
|
/** Audio source URL or Blob URL */
|
|
@@ -824,6 +831,14 @@ interface UseAnnotationKeyboardControlsOptions {
|
|
|
824
831
|
scrollContainerRef?: React.RefObject<HTMLDivElement | null>;
|
|
825
832
|
/** Optional: callback to start playback at a time with optional duration */
|
|
826
833
|
onPlay?: (startTime: number, duration?: number) => void;
|
|
834
|
+
/**
|
|
835
|
+
* Pixels-per-sample for auto-scroll positioning. Falls back to the
|
|
836
|
+
* WaveformPlaylistProvider context when omitted (WebAudio path). Pass
|
|
837
|
+
* explicitly when used outside that provider (e.g. the MediaElement path).
|
|
838
|
+
*/
|
|
839
|
+
samplesPerPixel?: number;
|
|
840
|
+
/** Sample rate for auto-scroll positioning. Falls back to context. */
|
|
841
|
+
sampleRate?: number;
|
|
827
842
|
}
|
|
828
843
|
/**
|
|
829
844
|
* Hook for keyboard-based annotation navigation and boundary editing
|
|
@@ -856,7 +871,7 @@ interface UseAnnotationKeyboardControlsOptions {
|
|
|
856
871
|
* });
|
|
857
872
|
* ```
|
|
858
873
|
*/
|
|
859
|
-
declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId, onAnnotationsChange, onActiveAnnotationChange, duration, linkEndpoints, continuousPlay, enabled, scrollContainerRef, onPlay, }: UseAnnotationKeyboardControlsOptions): {
|
|
874
|
+
declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId, onAnnotationsChange, onActiveAnnotationChange, duration, linkEndpoints, continuousPlay, enabled, scrollContainerRef, onPlay, samplesPerPixel: samplesPerPixelProp, sampleRate: sampleRateProp, }: UseAnnotationKeyboardControlsOptions): {
|
|
860
875
|
moveStartBoundary: (delta: number) => void;
|
|
861
876
|
moveEndBoundary: (delta: number) => void;
|
|
862
877
|
selectPrevious: () => void;
|
|
@@ -1850,4 +1865,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
|
|
|
1850
1865
|
bits: 8 | 16;
|
|
1851
1866
|
}>;
|
|
1852
1867
|
|
|
1853
|
-
export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramCanvasRegistration, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
|
|
1868
|
+
export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramCanvasRegistration, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistDataOptional, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
|
package/dist/index.js
CHANGED
|
@@ -150,6 +150,7 @@ __export(index_exports, {
|
|
|
150
150
|
usePlaybackShortcuts: () => usePlaybackShortcuts,
|
|
151
151
|
usePlaylistControls: () => usePlaylistControls,
|
|
152
152
|
usePlaylistData: () => usePlaylistData,
|
|
153
|
+
usePlaylistDataOptional: () => usePlaylistDataOptional,
|
|
153
154
|
usePlaylistState: () => usePlaylistState,
|
|
154
155
|
useSpectrogramIntegration: () => useSpectrogramIntegration,
|
|
155
156
|
useTimeFormat: () => useTimeFormat,
|
|
@@ -1393,9 +1394,13 @@ function useAnnotationKeyboardControls({
|
|
|
1393
1394
|
continuousPlay = false,
|
|
1394
1395
|
enabled = true,
|
|
1395
1396
|
scrollContainerRef,
|
|
1396
|
-
onPlay
|
|
1397
|
+
onPlay,
|
|
1398
|
+
samplesPerPixel: samplesPerPixelProp,
|
|
1399
|
+
sampleRate: sampleRateProp
|
|
1397
1400
|
}) {
|
|
1398
|
-
const
|
|
1401
|
+
const playlistData = usePlaylistDataOptional();
|
|
1402
|
+
const samplesPerPixel = samplesPerPixelProp != null ? samplesPerPixelProp : playlistData == null ? void 0 : playlistData.samplesPerPixel;
|
|
1403
|
+
const sampleRate = sampleRateProp != null ? sampleRateProp : playlistData == null ? void 0 : playlistData.sampleRate;
|
|
1399
1404
|
const activeIndex = (0, import_react16.useMemo)(() => {
|
|
1400
1405
|
if (!activeAnnotationId) return -1;
|
|
1401
1406
|
return annotations.findIndex((a) => a.id === activeAnnotationId);
|
|
@@ -4719,6 +4724,7 @@ var usePlaylistData = () => {
|
|
|
4719
4724
|
}
|
|
4720
4725
|
return context;
|
|
4721
4726
|
};
|
|
4727
|
+
var usePlaylistDataOptional = () => (0, import_react24.useContext)(PlaylistDataContext);
|
|
4722
4728
|
|
|
4723
4729
|
// src/MediaElementPlaylistContext.tsx
|
|
4724
4730
|
var import_react25 = require("react");
|
|
@@ -7320,6 +7326,7 @@ var ClipInteractionProvider = ({
|
|
|
7320
7326
|
usePlaybackShortcuts,
|
|
7321
7327
|
usePlaylistControls,
|
|
7322
7328
|
usePlaylistData,
|
|
7329
|
+
usePlaylistDataOptional,
|
|
7323
7330
|
usePlaylistState,
|
|
7324
7331
|
useSpectrogramIntegration,
|
|
7325
7332
|
useTimeFormat,
|