@bendyline/squisq-react 2.2.0 → 2.3.1

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.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * AudioController - Abstraction for audio playback in DocPlayer
3
+ *
4
+ * This module defines an interface for audio playback operations that can have
5
+ * different implementations depending on the runtime environment:
6
+ *
7
+ * - Site/Browser: Uses HTML5 Audio element directly
8
+ * - EFB/MSFS: Routes through CompanionAPI to Electron app
9
+ *
10
+ * The DocPlayer uses this abstraction instead of directly manipulating audio,
11
+ * allowing the same component code to work in both environments.
12
+ */
13
+
14
+ interface AudioState {
15
+ /** Current time in overall timeline (seconds) */
16
+ currentTime: number;
17
+ /** Whether audio is currently playing */
18
+ isPlaying: boolean;
19
+ /** Index of current audio segment */
20
+ currentSegment: number;
21
+ /** Total duration of all segments */
22
+ totalDuration: number;
23
+ /** Whether audio has finished */
24
+ isEnded: boolean;
25
+ /** Whether audio is loaded and ready to play */
26
+ isReady: boolean;
27
+ /** Whether the audio backend is available/connected */
28
+ isAvailable: boolean;
29
+ /** Message to show when not available */
30
+ unavailableMessage?: string;
31
+ }
32
+ interface AudioActions {
33
+ /** Start or resume playback */
34
+ play: () => Promise<void>;
35
+ /** Pause playback */
36
+ pause: () => Promise<void>;
37
+ /** Toggle play/pause */
38
+ toggle: () => Promise<void>;
39
+ /** Seek to specific time in timeline */
40
+ seekTo: (time: number) => Promise<void>;
41
+ /** Skip to specific segment */
42
+ skipToSegment: (index: number) => Promise<void>;
43
+ /** Restart from beginning */
44
+ restart: () => Promise<void>;
45
+ }
46
+ type AudioController = AudioState & AudioActions;
47
+
48
+ export type { AudioActions as A, AudioController as a, AudioState as b };