@vocalstack/player 0.0.0-stage → 0.1.0-alpha.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/dist/core/audio.d.ts +39 -0
  4. package/dist/core/background.d.ts +54 -0
  5. package/dist/core/clipPrefetch.d.ts +38 -0
  6. package/dist/core/clipQueue.d.ts +130 -0
  7. package/dist/core/format.d.ts +17 -0
  8. package/dist/core/mediaKeys.d.ts +14 -0
  9. package/dist/core/noAudio.d.ts +18 -0
  10. package/dist/core/playPosition.d.ts +18 -0
  11. package/dist/core/qr.d.ts +2 -0
  12. package/dist/core/readalong.d.ts +17 -0
  13. package/dist/core/transcript.d.ts +126 -0
  14. package/dist/core/voiceFollow.d.ts +44 -0
  15. package/dist/core/voiceRetry.d.ts +2 -0
  16. package/dist/core/voiceplayer.d.ts +31 -0
  17. package/dist/core/youtube.d.ts +9 -0
  18. package/dist/data/connect.d.ts +15 -0
  19. package/dist/data/context.d.ts +66 -0
  20. package/dist/data/errors.d.ts +9 -0
  21. package/dist/data/i18n.d.ts +425 -0
  22. package/dist/data/lookup.d.ts +4 -0
  23. package/dist/data/prefs.d.ts +14 -0
  24. package/dist/data/transcript.d.ts +27 -0
  25. package/dist/data/tx.d.ts +37 -0
  26. package/dist/data/voicePreview.d.ts +15 -0
  27. package/dist/ds/Controls.d.ts +163 -0
  28. package/dist/ds/Icons.d.ts +141 -0
  29. package/dist/ds/LanguagePicker.d.ts +34 -0
  30. package/dist/index.d.ts +6 -0
  31. package/dist/index.js +5470 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/style.css +1 -0
  34. package/dist/ui/EndCard.d.ts +11 -0
  35. package/dist/ui/SideColumn.d.ts +49 -0
  36. package/dist/ui/SourceGate.d.ts +8 -0
  37. package/dist/ui/VocalStackPlayer.d.ts +48 -0
  38. package/dist/ui/core.d.ts +227 -0
  39. package/dist/ui/full.d.ts +109 -0
  40. package/dist/ui/shared.d.ts +276 -0
  41. package/dist/ui/useDesk.d.ts +1 -0
  42. package/dist/ui/wait.d.ts +24 -0
  43. package/package.json +49 -4
@@ -0,0 +1,15 @@
1
+ export declare const DEFAULT_APP = "https://app.vocalstack.com";
2
+ export interface Started {
3
+ transcriptionId: string;
4
+ recordingId: string;
5
+ token: string;
6
+ expiresAt: string | null;
7
+ }
8
+ export type PopupStatus = 'signing-in' | 'consent' | 'checking' | 'starting';
9
+ export declare function openPopup(appUrl: string | undefined, ask: {
10
+ url?: string;
11
+ transcription?: string;
12
+ ask?: boolean;
13
+ }, onStatus?: (s: PopupStatus) => void): Promise<Started | null>;
14
+ export declare function startFromEmbed(appUrl: string | undefined, url: string, onStatus?: (s: PopupStatus) => void): Promise<Started | null>;
15
+ export declare function refreshToken(appUrl: string | undefined, transcriptionId: string): Promise<Started | null>;
@@ -0,0 +1,66 @@
1
+ import { type ReactNode } from 'react';
2
+ import { VocalStack, type Recording, type TranscriptionJob, type ReadAs } from '@vocalstack/js-sdk';
3
+ import type { MediaCred } from '../core/audio';
4
+ import { type ErrorLike } from './errors';
5
+ export declare const DEFAULT_API = "https://api.vocalstack.com";
6
+ export interface PlayerApi {
7
+ client: VocalStack;
8
+ origin: string;
9
+ owner: boolean;
10
+ shareCode: string | null;
11
+ listen: Listen | null;
12
+ bearer: () => Promise<string | undefined>;
13
+ cred: MediaCred;
14
+ readAs: ReadAs;
15
+ }
16
+ export interface PlayerSource {
17
+ key: string;
18
+ code: string | null;
19
+ transcriptionId: string | null;
20
+ name: string;
21
+ recording: Recording;
22
+ job: TranscriptionJob | null;
23
+ allowDownload: boolean;
24
+ allowExport: boolean;
25
+ allowTranslate: boolean;
26
+ sharedBy: string | null;
27
+ }
28
+ export declare function usePlayerApi(): PlayerApi;
29
+ export type PlayerApiProviderProps = {
30
+ children: ReactNode;
31
+ } & ({
32
+ value: PlayerApi;
33
+ } | (Partial<ApiOptions> & {
34
+ value?: undefined;
35
+ }));
36
+ export declare function PlayerApiProvider(props: PlayerApiProviderProps): import("react").JSX.Element;
37
+ export declare function isTranscriptionId(id: string): boolean;
38
+ export type TokenSource = string | (() => string | undefined | null | Promise<string | undefined | null>);
39
+ export interface Listen {
40
+ transcriptionId: string;
41
+ recordingId: string;
42
+ token: string;
43
+ }
44
+ export interface ApiOptions {
45
+ id?: string | null;
46
+ token?: TokenSource | null;
47
+ baseUrl?: string | null;
48
+ listen?: Listen | null;
49
+ listenerToken?: string | null;
50
+ client?: VocalStack | null;
51
+ }
52
+ export declare function useApi(o: ApiOptions): PlayerApi;
53
+ export declare function withMedia(api: PlayerApi, media: string | null): PlayerApi;
54
+ export declare function loadSource(api: PlayerApi, id: string): Promise<PlayerSource>;
55
+ export declare function useSource(api: PlayerApi, id: string): {
56
+ source: PlayerSource | null;
57
+ gone: boolean;
58
+ error: ErrorLike | null;
59
+ reload: () => void;
60
+ };
61
+ export declare function useMediaToken(api: PlayerApi, recordingId: string | null): string | null;
62
+ export declare function apiFetch(api: PlayerApi, path: string, init?: {
63
+ method?: string;
64
+ body?: unknown;
65
+ query?: Record<string, string | undefined>;
66
+ }): Promise<Response>;
@@ -0,0 +1,9 @@
1
+ export interface ErrorLike {
2
+ message: string;
3
+ code?: string;
4
+ status?: number;
5
+ details?: any;
6
+ }
7
+ export declare const GENERIC: string;
8
+ export declare const OFFLINE = "Can't reach VocalStack. Check your connection.";
9
+ export declare function describe(e: unknown): ErrorLike;
@@ -0,0 +1,425 @@
1
+ export type I18nKey = keyof typeof I18N.English;
2
+ export type Strings = Record<I18nKey, string>;
3
+ export declare const I18N: {
4
+ English: {
5
+ vcFor: string;
6
+ vcMute: string;
7
+ vcUnmute: string;
8
+ vcMuted: string;
9
+ vcShared: string;
10
+ vcUsedBy: string;
11
+ vcUnknownSpk: string;
12
+ vcUse: string;
13
+ vcGetting: string;
14
+ vcSample: string;
15
+ vcPreview: string;
16
+ vcMale: string;
17
+ vcFemale: string;
18
+ vcSynth: string;
19
+ origAudio: string;
20
+ vcCloned: string;
21
+ vcBadge: string;
22
+ vcNone: string;
23
+ vcNoVoice: string;
24
+ vcSheet: string;
25
+ vcNeutral: string;
26
+ vcWarm: string;
27
+ searchPlaceholder: string;
28
+ noise: string;
29
+ newLines: string;
30
+ live: string;
31
+ ended: string;
32
+ waiting: string;
33
+ corrected: string;
34
+ hostLine: string;
35
+ langLabel: string;
36
+ langCount: string;
37
+ read: string;
38
+ listen: string;
39
+ watch: string;
40
+ waitTitle: string;
41
+ waitBody: string;
42
+ english: string;
43
+ playing: string;
44
+ ready: string;
45
+ readyNote: string;
46
+ voiceMeta: string;
47
+ voice: string;
48
+ sheetTitle: string;
49
+ done: string;
50
+ search: string;
51
+ sheetNote: string;
52
+ moreLangs: string;
53
+ confTitle: string;
54
+ confBody: string;
55
+ confMid: string;
56
+ confHigh: string;
57
+ settings: string;
58
+ setOrig: string;
59
+ setTheme: string;
60
+ light: string;
61
+ dark: string;
62
+ setConf: string;
63
+ setConfHint1: string;
64
+ setConfMid: string;
65
+ setConfSep: string;
66
+ setConfLow: string;
67
+ setConfHint2: string;
68
+ behindLive: string;
69
+ behindNote: string;
70
+ shareLabel: string;
71
+ copy: string;
72
+ copied: string;
73
+ };
74
+ Spanish: {
75
+ vcFor: string;
76
+ vcMute: string;
77
+ vcUnmute: string;
78
+ vcMuted: string;
79
+ vcShared: string;
80
+ vcUsedBy: string;
81
+ vcUnknownSpk: string;
82
+ vcUse: string;
83
+ vcGetting: string;
84
+ vcSample: string;
85
+ vcPreview: string;
86
+ vcMale: string;
87
+ vcFemale: string;
88
+ vcSynth: string;
89
+ origAudio: string;
90
+ vcCloned: string;
91
+ vcBadge: string;
92
+ vcNone: string;
93
+ vcNoVoice: string;
94
+ vcSheet: string;
95
+ vcNeutral: string;
96
+ vcWarm: string;
97
+ searchPlaceholder: string;
98
+ noise: string;
99
+ newLines: string;
100
+ live: string;
101
+ ended: string;
102
+ waiting: string;
103
+ corrected: string;
104
+ hostLine: string;
105
+ langLabel: string;
106
+ langCount: string;
107
+ read: string;
108
+ listen: string;
109
+ watch: string;
110
+ waitTitle: string;
111
+ waitBody: string;
112
+ english: string;
113
+ playing: string;
114
+ ready: string;
115
+ readyNote: string;
116
+ voiceMeta: string;
117
+ voice: string;
118
+ sheetTitle: string;
119
+ done: string;
120
+ search: string;
121
+ sheetNote: string;
122
+ moreLangs: string;
123
+ confTitle: string;
124
+ confBody: string;
125
+ confMid: string;
126
+ confHigh: string;
127
+ settings: string;
128
+ setOrig: string;
129
+ setTheme: string;
130
+ light: string;
131
+ dark: string;
132
+ setConf: string;
133
+ setConfHint1: string;
134
+ setConfMid: string;
135
+ setConfSep: string;
136
+ setConfLow: string;
137
+ setConfHint2: string;
138
+ behindLive: string;
139
+ behindNote: string;
140
+ shareLabel: string;
141
+ copy: string;
142
+ copied: string;
143
+ };
144
+ French: {
145
+ vcFor: string;
146
+ vcMute: string;
147
+ vcUnmute: string;
148
+ vcMuted: string;
149
+ vcShared: string;
150
+ vcUsedBy: string;
151
+ vcUnknownSpk: string;
152
+ vcUse: string;
153
+ vcGetting: string;
154
+ vcSample: string;
155
+ vcPreview: string;
156
+ vcMale: string;
157
+ vcFemale: string;
158
+ vcSynth: string;
159
+ origAudio: string;
160
+ vcCloned: string;
161
+ vcBadge: string;
162
+ vcNone: string;
163
+ vcNoVoice: string;
164
+ vcSheet: string;
165
+ vcNeutral: string;
166
+ vcWarm: string;
167
+ searchPlaceholder: string;
168
+ noise: string;
169
+ newLines: string;
170
+ live: string;
171
+ ended: string;
172
+ waiting: string;
173
+ corrected: string;
174
+ hostLine: string;
175
+ langLabel: string;
176
+ langCount: string;
177
+ read: string;
178
+ listen: string;
179
+ watch: string;
180
+ waitTitle: string;
181
+ waitBody: string;
182
+ english: string;
183
+ playing: string;
184
+ ready: string;
185
+ readyNote: string;
186
+ voiceMeta: string;
187
+ voice: string;
188
+ sheetTitle: string;
189
+ done: string;
190
+ search: string;
191
+ sheetNote: string;
192
+ moreLangs: string;
193
+ confTitle: string;
194
+ confBody: string;
195
+ confMid: string;
196
+ confHigh: string;
197
+ settings: string;
198
+ setOrig: string;
199
+ setTheme: string;
200
+ light: string;
201
+ dark: string;
202
+ setConf: string;
203
+ setConfHint1: string;
204
+ setConfMid: string;
205
+ setConfSep: string;
206
+ setConfLow: string;
207
+ setConfHint2: string;
208
+ behindLive: string;
209
+ behindNote: string;
210
+ shareLabel: string;
211
+ copy: string;
212
+ copied: string;
213
+ };
214
+ Japanese: {
215
+ vcFor: string;
216
+ vcMute: string;
217
+ vcUnmute: string;
218
+ vcMuted: string;
219
+ vcShared: string;
220
+ vcUsedBy: string;
221
+ vcUnknownSpk: string;
222
+ vcUse: string;
223
+ vcGetting: string;
224
+ vcSample: string;
225
+ vcPreview: string;
226
+ vcMale: string;
227
+ vcFemale: string;
228
+ vcSynth: string;
229
+ origAudio: string;
230
+ vcCloned: string;
231
+ vcBadge: string;
232
+ vcNone: string;
233
+ vcNoVoice: string;
234
+ vcSheet: string;
235
+ vcNeutral: string;
236
+ vcWarm: string;
237
+ searchPlaceholder: string;
238
+ noise: string;
239
+ newLines: string;
240
+ live: string;
241
+ ended: string;
242
+ waiting: string;
243
+ corrected: string;
244
+ hostLine: string;
245
+ langLabel: string;
246
+ langCount: string;
247
+ read: string;
248
+ listen: string;
249
+ watch: string;
250
+ waitTitle: string;
251
+ waitBody: string;
252
+ english: string;
253
+ playing: string;
254
+ ready: string;
255
+ readyNote: string;
256
+ voiceMeta: string;
257
+ voice: string;
258
+ sheetTitle: string;
259
+ done: string;
260
+ search: string;
261
+ sheetNote: string;
262
+ moreLangs: string;
263
+ confTitle: string;
264
+ confBody: string;
265
+ confMid: string;
266
+ confHigh: string;
267
+ settings: string;
268
+ setOrig: string;
269
+ setTheme: string;
270
+ light: string;
271
+ dark: string;
272
+ setConf: string;
273
+ setConfHint1: string;
274
+ setConfMid: string;
275
+ setConfSep: string;
276
+ setConfLow: string;
277
+ setConfHint2: string;
278
+ behindLive: string;
279
+ behindNote: string;
280
+ shareLabel: string;
281
+ copy: string;
282
+ copied: string;
283
+ };
284
+ Romanian: {
285
+ vcFor: string;
286
+ vcMute: string;
287
+ vcUnmute: string;
288
+ vcMuted: string;
289
+ vcShared: string;
290
+ vcUsedBy: string;
291
+ vcUnknownSpk: string;
292
+ vcUse: string;
293
+ vcGetting: string;
294
+ vcSample: string;
295
+ vcPreview: string;
296
+ vcMale: string;
297
+ vcFemale: string;
298
+ vcSynth: string;
299
+ origAudio: string;
300
+ vcCloned: string;
301
+ vcBadge: string;
302
+ vcNone: string;
303
+ vcNoVoice: string;
304
+ vcSheet: string;
305
+ vcNeutral: string;
306
+ vcWarm: string;
307
+ searchPlaceholder: string;
308
+ noise: string;
309
+ newLines: string;
310
+ live: string;
311
+ ended: string;
312
+ waiting: string;
313
+ corrected: string;
314
+ hostLine: string;
315
+ langLabel: string;
316
+ langCount: string;
317
+ read: string;
318
+ listen: string;
319
+ watch: string;
320
+ waitTitle: string;
321
+ waitBody: string;
322
+ english: string;
323
+ playing: string;
324
+ ready: string;
325
+ readyNote: string;
326
+ voiceMeta: string;
327
+ voice: string;
328
+ sheetTitle: string;
329
+ done: string;
330
+ search: string;
331
+ sheetNote: string;
332
+ moreLangs: string;
333
+ confTitle: string;
334
+ confBody: string;
335
+ confMid: string;
336
+ confHigh: string;
337
+ settings: string;
338
+ setOrig: string;
339
+ setTheme: string;
340
+ light: string;
341
+ dark: string;
342
+ setConf: string;
343
+ setConfHint1: string;
344
+ setConfMid: string;
345
+ setConfSep: string;
346
+ setConfLow: string;
347
+ setConfHint2: string;
348
+ behindLive: string;
349
+ behindNote: string;
350
+ shareLabel: string;
351
+ copy: string;
352
+ copied: string;
353
+ };
354
+ Portuguese: {
355
+ vcFor: string;
356
+ vcMute: string;
357
+ vcUnmute: string;
358
+ vcMuted: string;
359
+ vcShared: string;
360
+ vcUsedBy: string;
361
+ vcUnknownSpk: string;
362
+ vcUse: string;
363
+ vcGetting: string;
364
+ vcSample: string;
365
+ vcPreview: string;
366
+ vcMale: string;
367
+ vcFemale: string;
368
+ vcSynth: string;
369
+ origAudio: string;
370
+ vcCloned: string;
371
+ vcBadge: string;
372
+ vcNone: string;
373
+ vcNoVoice: string;
374
+ vcSheet: string;
375
+ vcNeutral: string;
376
+ vcWarm: string;
377
+ searchPlaceholder: string;
378
+ noise: string;
379
+ newLines: string;
380
+ live: string;
381
+ ended: string;
382
+ waiting: string;
383
+ corrected: string;
384
+ hostLine: string;
385
+ langLabel: string;
386
+ langCount: string;
387
+ read: string;
388
+ listen: string;
389
+ watch: string;
390
+ waitTitle: string;
391
+ waitBody: string;
392
+ english: string;
393
+ playing: string;
394
+ ready: string;
395
+ readyNote: string;
396
+ voiceMeta: string;
397
+ voice: string;
398
+ sheetTitle: string;
399
+ done: string;
400
+ search: string;
401
+ sheetNote: string;
402
+ moreLangs: string;
403
+ confTitle: string;
404
+ confBody: string;
405
+ confMid: string;
406
+ confHigh: string;
407
+ settings: string;
408
+ setOrig: string;
409
+ setTheme: string;
410
+ light: string;
411
+ dark: string;
412
+ setConf: string;
413
+ setConfHint1: string;
414
+ setConfMid: string;
415
+ setConfSep: string;
416
+ setConfLow: string;
417
+ setConfHint2: string;
418
+ behindLive: string;
419
+ behindNote: string;
420
+ shareLabel: string;
421
+ copy: string;
422
+ copied: string;
423
+ };
424
+ };
425
+ export declare function strings(name?: string | null): Strings;
@@ -0,0 +1,4 @@
1
+ import { type TokenSource } from './context';
2
+ export declare function useLookup(src: string | null, token: TokenSource | null, baseUrl: string | null): {
3
+ id: string;
4
+ } | null | undefined;
@@ -0,0 +1,14 @@
1
+ import type { LanguageLists } from '@vocalstack/js-sdk';
2
+ export declare function useStored<T>(key: string, fallback: T): [T, (v: T) => void];
3
+ export declare function forgetRecentLang(code: string): void;
4
+ export declare function useRecentLangs(): [string[], (code: string | null) => void];
5
+ export declare function pickerLanguages(langs: LanguageLists | null, kind: 'transcription' | 'translation' | 'voice'): {
6
+ code: string;
7
+ label: string;
8
+ native: string;
9
+ flag: string;
10
+ voice: boolean;
11
+ }[];
12
+ export declare function useSidePins(id: string): [string[], (v: string[]) => void];
13
+ export declare const COL_W = 352;
14
+ export declare function useColW(id: string): [number, (v: number | null) => void];
@@ -0,0 +1,27 @@
1
+ import type { LanguageLists } from '@vocalstack/js-sdk';
2
+ import { type Model } from '../core/transcript';
3
+ import { describe, type ErrorLike } from './errors';
4
+ export { describe, type ErrorLike };
5
+ export declare function useLanguages(): LanguageLists | null;
6
+ export declare function useAsync<T>(fn: () => Promise<T>, deps: unknown[]): {
7
+ data: T | null;
8
+ error: ErrorLike | null;
9
+ reload: () => void;
10
+ };
11
+ export declare function useTranscript(recordingId: string | null, opts: {
12
+ lang?: string | null;
13
+ voice?: string | null;
14
+ onState?: (s: string, reason?: string) => void;
15
+ onFrame?: (f: any) => void;
16
+ }): {
17
+ model: Model;
18
+ connected: boolean;
19
+ error: ErrorLike | null;
20
+ notFound: boolean;
21
+ clearError: () => void;
22
+ setLanguage: (lang: string | null) => void;
23
+ mergeTranslations: (lang: string, made: Record<string, string>) => void;
24
+ translating: boolean;
25
+ translateFailed: string | null;
26
+ shownLang: string | null;
27
+ };
@@ -0,0 +1,37 @@
1
+ import type { ExportFormat, TranscriptionJob } from '@vocalstack/js-sdk';
2
+ import { type MediaCred } from '../core/audio';
3
+ import type { PlayerApi } from './context';
4
+ export type TxRowStatus = 'queued' | 'cropping' | 'transcribing' | 'done' | 'failed' | 'stopped' | 'live';
5
+ export interface TxProgress {
6
+ state: TranscriptionJob['state'];
7
+ processedS: number;
8
+ totalS: number | null;
9
+ segmentsDone: number;
10
+ segmentsTotal: number | null;
11
+ pct: number;
12
+ error?: string | null;
13
+ }
14
+ export declare function rowStatusOf(state: TranscriptionJob['state'] | undefined | null): TxRowStatus;
15
+ export declare function progressOf(job: TranscriptionJob | null): TxProgress | null;
16
+ export declare const segsLabel: (p: TxProgress | null, fallbackDone: number) => string;
17
+ export declare function jobLengthS(job: TranscriptionJob | null | undefined, progress?: TxProgress | null): number | null;
18
+ export declare const TX_FORMATS: {
19
+ key: ExportFormat;
20
+ name: string;
21
+ ext: string;
22
+ note: string;
23
+ icon: string;
24
+ }[];
25
+ export declare function saveUrl(url: string): void;
26
+ export declare function saveWhenReady(url: string): Promise<void>;
27
+ export declare function exportTranscript(api: PlayerApi, recordingId: string, key: ExportFormat, opts?: {
28
+ lang?: string | null;
29
+ }): Promise<void>;
30
+ export declare function downloadVoiceTrack(api: PlayerApi, opts: {
31
+ recordingId: string;
32
+ lang: string;
33
+ voiceKey: string;
34
+ cred: MediaCred;
35
+ request: () => Promise<unknown>;
36
+ timeoutMs?: number;
37
+ }): Promise<void>;
@@ -0,0 +1,15 @@
1
+ import { type ErrorLike } from './errors';
2
+ export interface PreviewableVoice {
3
+ id: string;
4
+ previewUrl?: string;
5
+ }
6
+ export declare function useVoicePreview(lang: string | null): {
7
+ armId: string | null;
8
+ sampleId: string | null;
9
+ dlId: string | null;
10
+ error: ErrorLike | null;
11
+ clearError: () => void;
12
+ arm: (v: PreviewableVoice) => void;
13
+ stop: () => void;
14
+ reset: () => void;
15
+ };