@waveform-playlist/browser 5.0.0-alpha.13 → 5.0.0-alpha.14
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 +144 -0
- package/dist/index.js +145 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3278 -2519
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { default as default_3 } from 'waveform-data';
|
|
|
4
4
|
import { DragEndEvent } from '@dnd-kit/core';
|
|
5
5
|
import { Fade as Fade_2 } from '@waveform-playlist/core';
|
|
6
6
|
import { Gain } from 'tone';
|
|
7
|
+
import { MediaElementPlayout } from '@waveform-playlist/media-element-playout';
|
|
7
8
|
import { MutableRefObject } from 'react';
|
|
8
9
|
import react__default from 'react';
|
|
9
10
|
import { ReactNode } from 'react';
|
|
@@ -530,6 +531,141 @@ export declare interface MasterVolumeControls {
|
|
|
530
531
|
setMasterVolume: (volume: number) => void;
|
|
531
532
|
}
|
|
532
533
|
|
|
534
|
+
export declare interface MediaElementAnimationContextValue {
|
|
535
|
+
isPlaying: boolean;
|
|
536
|
+
currentTime: number;
|
|
537
|
+
currentTimeRef: default_2.RefObject<number>;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export declare interface MediaElementControlsContextValue {
|
|
541
|
+
play: (startTime?: number) => void;
|
|
542
|
+
pause: () => void;
|
|
543
|
+
stop: () => void;
|
|
544
|
+
seekTo: (time: number) => void;
|
|
545
|
+
setPlaybackRate: (rate: number) => void;
|
|
546
|
+
setContinuousPlay: (enabled: boolean) => void;
|
|
547
|
+
setAnnotations: (annotations: AnnotationData[]) => void;
|
|
548
|
+
setActiveAnnotationId: (id: string | null) => void;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export declare interface MediaElementDataContextValue {
|
|
552
|
+
duration: number;
|
|
553
|
+
peaksDataArray: TrackClipPeaks[];
|
|
554
|
+
sampleRate: number;
|
|
555
|
+
waveHeight: number;
|
|
556
|
+
timeScaleHeight: number;
|
|
557
|
+
samplesPerPixel: number;
|
|
558
|
+
playoutRef: default_2.RefObject<MediaElementPlayout | null>;
|
|
559
|
+
controls: {
|
|
560
|
+
show: boolean;
|
|
561
|
+
width: number;
|
|
562
|
+
};
|
|
563
|
+
barWidth: number;
|
|
564
|
+
barGap: number;
|
|
565
|
+
progressBarWidth: number;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* MediaElementPlaylistProvider
|
|
570
|
+
*
|
|
571
|
+
* A simplified playlist provider for single-track playback using HTMLAudioElement.
|
|
572
|
+
* Key features:
|
|
573
|
+
* - Pitch-preserving playback rate (0.5x - 2.0x)
|
|
574
|
+
* - Pre-computed peaks visualization (no AudioBuffer needed)
|
|
575
|
+
* - Simpler API than full WaveformPlaylistProvider
|
|
576
|
+
*
|
|
577
|
+
* Use this for:
|
|
578
|
+
* - Language learning apps (speed control)
|
|
579
|
+
* - Podcast players
|
|
580
|
+
* - Single-track audio viewers
|
|
581
|
+
*
|
|
582
|
+
* For multi-track editing, use WaveformPlaylistProvider instead.
|
|
583
|
+
*/
|
|
584
|
+
export declare const MediaElementPlaylistProvider: default_2.FC<MediaElementPlaylistProviderProps>;
|
|
585
|
+
|
|
586
|
+
declare interface MediaElementPlaylistProviderProps {
|
|
587
|
+
/** Single track configuration with source URL and waveform data */
|
|
588
|
+
track: MediaElementTrackConfig;
|
|
589
|
+
/** Initial samples per pixel (zoom level) */
|
|
590
|
+
samplesPerPixel?: number;
|
|
591
|
+
/** Height of each waveform track */
|
|
592
|
+
waveHeight?: number;
|
|
593
|
+
/** Show timescale */
|
|
594
|
+
timescale?: boolean;
|
|
595
|
+
/** Initial playback rate (0.5 to 2.0) */
|
|
596
|
+
playbackRate?: number;
|
|
597
|
+
/** Theme configuration */
|
|
598
|
+
theme?: Partial<WaveformPlaylistTheme>;
|
|
599
|
+
/** Track controls configuration */
|
|
600
|
+
controls?: {
|
|
601
|
+
show: boolean;
|
|
602
|
+
width: number;
|
|
603
|
+
};
|
|
604
|
+
/** Annotations */
|
|
605
|
+
annotationList?: {
|
|
606
|
+
annotations?: any[];
|
|
607
|
+
isContinuousPlay?: boolean;
|
|
608
|
+
};
|
|
609
|
+
/** Width of waveform bars */
|
|
610
|
+
barWidth?: number;
|
|
611
|
+
/** Gap between waveform bars */
|
|
612
|
+
barGap?: number;
|
|
613
|
+
/** Width of progress bars */
|
|
614
|
+
progressBarWidth?: number;
|
|
615
|
+
/** Callback when audio is ready */
|
|
616
|
+
onReady?: () => void;
|
|
617
|
+
children: ReactNode;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
export declare interface MediaElementStateContextValue {
|
|
621
|
+
continuousPlay: boolean;
|
|
622
|
+
annotations: AnnotationData[];
|
|
623
|
+
activeAnnotationId: string | null;
|
|
624
|
+
playbackRate: number;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export declare interface MediaElementTrackConfig {
|
|
628
|
+
/** Audio source URL or Blob URL */
|
|
629
|
+
source: string;
|
|
630
|
+
/** Pre-computed waveform data (required for visualization) */
|
|
631
|
+
waveformData: WaveformDataObject;
|
|
632
|
+
/** Track name for display */
|
|
633
|
+
name?: string;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Simplified Waveform component for MediaElementPlaylistProvider
|
|
638
|
+
*
|
|
639
|
+
* This is a stripped-down version of Waveform that works with the
|
|
640
|
+
* MediaElement context. It supports:
|
|
641
|
+
* - Single track visualization
|
|
642
|
+
* - Click to seek
|
|
643
|
+
* - Annotation display and click-to-play
|
|
644
|
+
* - Playhead animation
|
|
645
|
+
*
|
|
646
|
+
* For multi-track editing, use the full Waveform with WaveformPlaylistProvider.
|
|
647
|
+
*/
|
|
648
|
+
export declare const MediaElementWaveform: default_2.FC<MediaElementWaveformProps>;
|
|
649
|
+
|
|
650
|
+
export declare interface MediaElementWaveformProps {
|
|
651
|
+
/** Height in pixels for the annotation text list */
|
|
652
|
+
annotationTextHeight?: number;
|
|
653
|
+
/** Custom function to generate the label shown on annotation boxes */
|
|
654
|
+
getAnnotationBoxLabel?: (annotation: {
|
|
655
|
+
id: string;
|
|
656
|
+
start: number;
|
|
657
|
+
end: number;
|
|
658
|
+
lines: string[];
|
|
659
|
+
}) => string;
|
|
660
|
+
/**
|
|
661
|
+
* Custom render function for annotation items in the text list.
|
|
662
|
+
* When provided, completely replaces the default annotation item rendering.
|
|
663
|
+
* Use this to customize the appearance of each annotation (e.g., add furigana).
|
|
664
|
+
*/
|
|
665
|
+
renderAnnotationItem?: (props: RenderAnnotationItemProps) => default_2.ReactNode;
|
|
666
|
+
className?: string;
|
|
667
|
+
}
|
|
668
|
+
|
|
533
669
|
declare interface MicrophoneDevice {
|
|
534
670
|
deviceId: string;
|
|
535
671
|
label: string;
|
|
@@ -1314,6 +1450,14 @@ declare interface UseMasterVolumeProps {
|
|
|
1314
1450
|
onVolumeChange?: (volume: number) => void;
|
|
1315
1451
|
}
|
|
1316
1452
|
|
|
1453
|
+
export declare const useMediaElementAnimation: () => MediaElementAnimationContextValue;
|
|
1454
|
+
|
|
1455
|
+
export declare const useMediaElementControls: () => MediaElementControlsContextValue;
|
|
1456
|
+
|
|
1457
|
+
export declare const useMediaElementData: () => MediaElementDataContextValue;
|
|
1458
|
+
|
|
1459
|
+
export declare const useMediaElementState: () => MediaElementStateContextValue;
|
|
1460
|
+
|
|
1317
1461
|
export declare const usePlaybackAnimation: () => PlaybackAnimationContextValue;
|
|
1318
1462
|
|
|
1319
1463
|
/**
|