@vidtreo/recorder-react 1.7.8 → 1.8.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/README.md +211 -12
- package/dist/index.d.ts +45 -18
- package/dist/index.js +1 -1
- package/dist/recorder-react.css +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -46,12 +46,13 @@ import VidtreoRecorder from '@vidtreo/recorder-react';
|
|
|
46
46
|
|
|
47
47
|
| Prop | Type | Required | Default | Description |
|
|
48
48
|
|------|------|----------|---------|-------------|
|
|
49
|
-
| `apiKey` | `string` | No* | - | API key for authentication. Required if `VIDTREO_API_KEY` env var not set. |
|
|
49
|
+
| `apiKey` | `string` | No* | - | API key for authentication. Required if `VIDTREO_API_KEY` env var not set and `getAccessToken` is not used. |
|
|
50
|
+
| `getAccessToken` | `() => Promise<string>` | No* | - | Returns a short-lived desktop access token minted by your server. Use instead of `apiKey` (exactly one of the two; passing both shows a configuration error, see [Credentials](#temporary-access-tokens)). Called again whenever a fresh token is needed, including when a queued upload resumes after a reload. |
|
|
50
51
|
| `countdownDuration` | `number` | No | - | Countdown duration in milliseconds before recording starts |
|
|
51
52
|
| `minTimeRecord` | `number` | No | - | Minimum recording time in milliseconds before stop is allowed. Must not be greater than `maxRecordingTime` when both are positive. |
|
|
52
53
|
| `maxRecordingTime` | `number` | No | - | Maximum recording time in milliseconds |
|
|
53
54
|
| `userMetadata` | `Record<string, unknown>` | No | - | Custom metadata to attach to recordings |
|
|
54
|
-
| `recordingPrompt` | `RecordingPrompt` | No | - | Prompt shown during recording. Use `countdown: { show, placement: "above-countdown" }` to float it over the countdown. |
|
|
55
|
+
| `recordingPrompt` | `RecordingPrompt` | No | - | Prompt shown during recording. Use `countdown: { show, placement: "above-countdown" }` to float it over the countdown. A `label` field is still accepted for backward compatibility but is not displayed. |
|
|
55
56
|
| `enableSourceSwitching` | `boolean` | No | `true` | Enable switching between camera and screen |
|
|
56
57
|
| `enableMute` | `boolean` | No | `true` | Enable mute/unmute functionality |
|
|
57
58
|
| `enablePause` | `boolean` | No | `true` | Enable pause/resume functionality |
|
|
@@ -62,13 +63,13 @@ import VidtreoRecorder from '@vidtreo/recorder-react';
|
|
|
62
63
|
| `maxFileSize` | `number` | No | `2560` | Maximum file size in megabytes (default: 2.5GB) |
|
|
63
64
|
| `lang` | `string` | No | `"en"` | Language code for UI text (`"en"` or `"es"`) |
|
|
64
65
|
| `texts` | `PartialTranslations` | No | - | Custom text overrides for localization |
|
|
65
|
-
| `onUploadComplete` | `(result:
|
|
66
|
-
| `onUploadProgress` | `(progress: number) => void` | No | - | Callback for upload progress (0-1) |
|
|
67
|
-
| `onUploadError` | `(error: Error) => void` | No | - | Callback when upload fails |
|
|
66
|
+
| `onUploadComplete` | `(result: RecordingUploadResult) => void` | No | - | Callback when upload completes. Same payload for the desktop/overlay recorder and native camera mode. See [Upload Completion Payload](#upload-completion-payload) |
|
|
67
|
+
| `onUploadProgress` | `(progress: number, phase: UploadProgressPhase \| null) => void` | No | - | Callback for upload progress (0-1) in every mode. `phase` is `"preparing"`, `"transferring"`, `"finalizing"`, `"completed"` or `null` when not reported yet (the first `0` call) |
|
|
68
|
+
| `onUploadError` | `(error: Error) => void` | No | - | Callback when upload fails. Use `getUploadErrorCode(error)` to read the [error code](#upload-errors) |
|
|
68
69
|
| `onRecordingStart` | `() => void` | No | - | Callback when recording starts |
|
|
69
|
-
| `onRecordingStop` | `() => void` | No | - | Callback when recording stops |
|
|
70
|
-
| `onTranscodingProgress` | `(progress: number) => void` | No | - | Callback for transcoding progress (0-
|
|
71
|
-
| `onError` | `(error: Error) => void` | No | - | Callback for any errors |
|
|
70
|
+
| `onRecordingStop` | `() => void` | No | - | Callback when recording stops (once per recording, when finalization starts) |
|
|
71
|
+
| `onTranscodingProgress` | `(progress: number) => void` | No | - | Callback for transcoding progress (0-1). While it runs the recorder shows the `finishing` progress overlay |
|
|
72
|
+
| `onError` | `(error: Error) => void` | No | - | Callback for any errors, including the credential conflict configuration error |
|
|
72
73
|
|
|
73
74
|
`tabVisibilityOverlayText` is optional. When `enableTabVisibilityOverlay` is enabled and text is omitted, the component
|
|
74
75
|
uses a localized default based on `lang` and `texts`. Overlay rendering is skipped for screen capture recordings.
|
|
@@ -82,8 +83,8 @@ uses a localized default based on `lang` and `texts`. Overlay rendering is skipp
|
|
|
82
83
|
console.log('Recording uploaded:', result.recordingId);
|
|
83
84
|
console.log('View at:', result.uploadUrl);
|
|
84
85
|
}}
|
|
85
|
-
onUploadProgress={(progress) => {
|
|
86
|
-
console.log(`Upload: ${Math.round(progress * 100)}%`);
|
|
86
|
+
onUploadProgress={(progress, phase) => {
|
|
87
|
+
console.log(`Upload (${phase ?? "starting"}): ${Math.round(progress * 100)}%`);
|
|
87
88
|
}}
|
|
88
89
|
onError={(error) => {
|
|
89
90
|
console.error('Error:', error.message);
|
|
@@ -91,6 +92,90 @@ uses a localized default based on `lang` and `texts`. Overlay rendering is skipp
|
|
|
91
92
|
/>
|
|
92
93
|
```
|
|
93
94
|
|
|
95
|
+
### Temporary Access Tokens
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<VidtreoRecorder
|
|
99
|
+
getAccessToken={async () => {
|
|
100
|
+
const response = await fetch('/api/vidtreo-token');
|
|
101
|
+
const { token } = await response.json();
|
|
102
|
+
return token;
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The token is never stored. If an upload is interrupted, the component calls `getAccessToken` again when the upload resumes.
|
|
108
|
+
|
|
109
|
+
Pass either `apiKey` or `getAccessToken`, not both. The prop types reject both at compile time; at runtime (for example from JavaScript) the component renders the configuration error "Provide either apiKey or getAccessToken, not both" and calls `onError` once with an error whose `code` is `CONFIG_ERROR_CREDENTIAL_CONFLICT` (`"config.credential-conflict"`, from `@vidtreo/recorder`). Passing neither (outside demo mode, and without `VIDTREO_API_KEY` in the environment) renders the `errorApiKeyRequired` configuration error and calls `onError` once. Demo mode ignores credentials.
|
|
110
|
+
|
|
111
|
+
### Progress Overlays
|
|
112
|
+
|
|
113
|
+
After you stop a recording the preview shows a progress overlay until the upload finishes:
|
|
114
|
+
|
|
115
|
+
| Stage | Label key | Progress |
|
|
116
|
+
|-------|-----------|----------|
|
|
117
|
+
| Finalizing the recording (before transcoding reports progress) | `finishing` | 0% |
|
|
118
|
+
| Transcoding | `finishing` | transcoding progress |
|
|
119
|
+
| Uploading | `uploading`, `finalizing` when the backend is finalizing, `retryingUpload` while a retry is pending | upload progress |
|
|
120
|
+
|
|
121
|
+
The same overlays show in the mobile overlay recorder. In native camera mode a resumed upload without a preview shows a standalone progress bar with the same labels.
|
|
122
|
+
|
|
123
|
+
### Upload Completion Payload
|
|
124
|
+
|
|
125
|
+
`onUploadComplete` receives a `RecordingUploadResult`: every field of the backend upload result plus the backward-compatible `recordingId` and `uploadUrl`.
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import type { RecordingUploadResult } from '@vidtreo/recorder-react';
|
|
129
|
+
|
|
130
|
+
type RecordingUploadResult = {
|
|
131
|
+
recordingId: string; // same value as id
|
|
132
|
+
uploadUrl: string; // "" when the backend has no URL yet
|
|
133
|
+
id: string;
|
|
134
|
+
publicId: string;
|
|
135
|
+
filename: string;
|
|
136
|
+
fileSize: number;
|
|
137
|
+
mimeType: string;
|
|
138
|
+
duration: number | null;
|
|
139
|
+
status: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
transferStatus: 'pending' | 'transferring' | 'transferred' | 'failed' | null;
|
|
142
|
+
transferError: string | null;
|
|
143
|
+
transferredAt: string | null;
|
|
144
|
+
r2DeleteAfter: string | null;
|
|
145
|
+
r2DeletedAt: string | null;
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Upload Errors
|
|
150
|
+
|
|
151
|
+
When an upload fails with a known cause, the component shows a dialog (`role="alertdialog"`) after recording and processing finish, and `onUploadError` receives an error with a code:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import VidtreoRecorder, {
|
|
155
|
+
getUploadErrorCode,
|
|
156
|
+
UPLOAD_ERROR_INSUFFICIENT_CREDITS,
|
|
157
|
+
} from '@vidtreo/recorder-react';
|
|
158
|
+
|
|
159
|
+
<VidtreoRecorder
|
|
160
|
+
apiKey="your-api-key"
|
|
161
|
+
onUploadError={(error) => {
|
|
162
|
+
if (getUploadErrorCode(error) === UPLOAD_ERROR_INSUFFICIENT_CREDITS) {
|
|
163
|
+
notifyAdmin();
|
|
164
|
+
}
|
|
165
|
+
}}
|
|
166
|
+
/>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
| Code | Meaning |
|
|
170
|
+
|------|---------|
|
|
171
|
+
| `upload.insufficient-credits` | The account has no credits left (HTTP 402). The upload is not retried. |
|
|
172
|
+
|
|
173
|
+
`getUploadErrorCode` returns `null` for other errors. Network errors are retried automatically before they are reported.
|
|
174
|
+
|
|
175
|
+
### Upload Resume
|
|
176
|
+
|
|
177
|
+
Uploads are queued in IndexedDB before they are sent, in every mode (desktop, mobile overlay, mobile embed, and native camera). If the page is reloaded or the connection drops, the next mounted `VidtreoRecorder` resumes the upload with the same idempotency key and sends only the parts that are missing. Progress shows again while it resumes, and `onUploadComplete` fires with the full payload when it finishes. Mount the component with the same credentials (`apiKey` or `getAccessToken`) so the upload can resume. If IndexedDB is unavailable, uploads go directly to the backend without persistence.
|
|
178
|
+
|
|
94
179
|
### Minimum Recording Time
|
|
95
180
|
|
|
96
181
|
```tsx
|
|
@@ -147,6 +232,10 @@ function CustomRecorder() {
|
|
|
147
232
|
countdown: number | null;
|
|
148
233
|
timer: string;
|
|
149
234
|
uploadProgress: number | null;
|
|
235
|
+
uploadPhase: UploadProgressPhase | null; // 'preparing' | 'transferring' | 'finalizing' | 'completed'
|
|
236
|
+
uploadRetryAttempt: number | null;
|
|
237
|
+
uploadErrorCode: UploadErrorCode | null; // 'upload.insufficient-credits'
|
|
238
|
+
transcodingProgress: number | null;
|
|
150
239
|
devices: {
|
|
151
240
|
cameras: MediaDeviceInfo[];
|
|
152
241
|
microphones: MediaDeviceInfo[];
|
|
@@ -164,9 +253,12 @@ function CustomRecorder() {
|
|
|
164
253
|
- `resumeRecording()` - Resume recording
|
|
165
254
|
- `toggleMute()` - Toggle mute state
|
|
166
255
|
- `switchSource(sourceType: 'camera' | 'screen')` - Switch between camera and screen
|
|
256
|
+
- `reselectScreenSource()` - Pick another screen or window without changing the source type (resolves `false` when cancelled)
|
|
167
257
|
- `changeCamera(deviceId: string)` - Change camera device
|
|
168
258
|
- `changeMic(deviceId: string)` - Change microphone device
|
|
169
259
|
- `startPreview(sourceType?: 'camera' | 'screen')` - Start preview stream
|
|
260
|
+
- `downloadVideo()` - Download the recorded video (demo mode)
|
|
261
|
+
- `clearUploadError()` - Clear `uploadErrorCode` after the user dismisses the upload error
|
|
170
262
|
- `cleanup()` - Clean up resources
|
|
171
263
|
|
|
172
264
|
### Hook Return
|
|
@@ -372,6 +464,70 @@ function App() {
|
|
|
372
464
|
|-----|----------------|-----------------|
|
|
373
465
|
| `initializingCamera` | Initializing camera... | Inicializando cámara... |
|
|
374
466
|
| `grantPermissions` | Grant camera and microphone permissions when prompted | Otorga permisos de cámara y micrófono cuando se solicite |
|
|
467
|
+
| `browserUnsupported` | This browser is not supported | Este navegador no es compatible |
|
|
468
|
+
| `browserUnsupportedDynamic` | `{browser} ({version}) is not supported, please use <a href="https://www.google.com/chrome/" target="_blank" rel="noopener noreferrer">Chrome</a>` | `{browser} ({version}) no es compatible, por favor usa <a href="https://www.google.com/chrome/" target="_blank" rel="noopener noreferrer">Chrome</a>` |
|
|
469
|
+
| `browserUnsupportedSafari` | `Safari (latest stable) is supported. If you experience issues, please use <a href="https://www.google.com/chrome/" target="_blank" rel="noopener noreferrer">Chrome</a>` | `Safari (última versión estable) es compatible. Si experimentas problemas, por favor usa <a href="https://www.google.com/chrome/" target="_blank" rel="noopener noreferrer">Chrome</a>` |
|
|
470
|
+
| `browserUnsupportedFirefox` | `Firefox is not supported, please use <a href="https://www.google.com/chrome/" target="_blank" rel="noopener noreferrer">Chrome</a>` | `Firefox no es compatible, por favor use <a href="https://www.google.com/chrome/" target="_blank" rel="noopener noreferrer">Chrome</a>` |
|
|
471
|
+
| `retryCamera` | Retry Camera | Reintentar Cámara |
|
|
472
|
+
| `cameraInUse` | Your camera is being used by another application. Close other apps using the camera (Zoom, Teams, Discord) and try again. | Tu cámara está siendo usada por otra aplicación. Cierra otras apps que usen la cámara (Zoom, Teams, Discord) e intenta de nuevo. |
|
|
473
|
+
| `cameraNotFound` | No camera detected. Connect a camera or check your device settings. | No se detectó ninguna cámara. Conecta una cámara o revisa la configuración de tu dispositivo. |
|
|
474
|
+
| `cameraPermissionDenied` | Camera access was denied. Allow camera access in your browser settings and try again. | Se denegó el acceso a la cámara. Permite el acceso a la cámara en la configuración de tu navegador e intenta de nuevo. |
|
|
475
|
+
| `cameraTimeout` | The camera took too long to start. Close other apps using the camera and try again. | La cámara tardó demasiado en iniciar. Cierra otras apps que usen la cámara e intenta de nuevo. |
|
|
476
|
+
| `failedToStartCamera` | Failed to start camera | Error al iniciar la cámara |
|
|
477
|
+
| `audioInUse` | Your microphone is being used by another application. Close other apps using the microphone (Zoom, Teams, Discord) and try again. | Tu micrófono está siendo usado por otra aplicación. Cierra otras apps que usen el micrófono (Zoom, Teams, Discord) e intenta de nuevo. |
|
|
478
|
+
| `audioNotFound` | No microphone detected. Connect a microphone or check your device settings. | No se detectó ningún micrófono. Conecta un micrófono o revisa la configuración de tu dispositivo. |
|
|
479
|
+
| `audioPermissionDenied` | Microphone access was denied. Allow microphone access in your browser settings and try again. | Se denegó el acceso al micrófono. Permite el acceso al micrófono en la configuración de tu navegador e intenta de nuevo. |
|
|
480
|
+
| `audioTimeout` | The microphone took too long to start. Close other apps using the microphone and try again. | El micrófono tardó demasiado en iniciar. Cierra otras apps que usen el micrófono e intenta de nuevo. |
|
|
481
|
+
| `failedToStartAudio` | Failed to start microphone | Error al iniciar el micrófono |
|
|
482
|
+
| `audioErrorTitle` | Microphone unavailable | Micrófono no disponible |
|
|
483
|
+
| `audioErrorMessage` | We couldn't access your microphone. It may be in use by another app like Zoom, Teams, or Discord. Please close it and try again. | No pudimos acceder a tu micrófono. Puede estar en uso por otra app como Zoom, Teams o Discord. Ciérrala e inténtalo de nuevo. |
|
|
484
|
+
| `audioErrorRetry` | Try again | Intentar de nuevo |
|
|
485
|
+
| `audioMissingTitle` | Recording has no audio | La grabación no tiene audio |
|
|
486
|
+
| `audioMissingMessage` | We couldn't capture audio in this recording. Your microphone may have been disconnected or blocked by the browser. Check your microphone and record again. | No pudimos capturar audio en esta grabación. Es posible que el micrófono se haya desconectado o que el navegador lo haya bloqueado. Verifica tu micrófono y vuelve a grabar. |
|
|
487
|
+
| `audioSilentTitle` | Recording is silent | La grabación quedó en silencio |
|
|
488
|
+
| `audioSilentMessage` | We didn't detect any sound during the recording. Make sure your microphone is working and not muted by your operating system, then record again. | No detectamos sonido durante la grabación. Verifica que tu micrófono esté funcionando y no esté silenciado por el sistema, luego vuelve a grabar. |
|
|
489
|
+
| `audioProcessingErrorTitle` | Audio processing error | Error al procesar el audio |
|
|
490
|
+
| `audioProcessingErrorMessage` | We couldn't process the audio in this recording. Please record again. | No pudimos procesar el audio de esta grabación. Por favor vuelve a grabar. |
|
|
491
|
+
| `audioMissingRetry` | Record again | Grabar de nuevo |
|
|
492
|
+
| `audioWarningNoSignalTitle` | No microphone signal | Sin señal del micrófono |
|
|
493
|
+
| `audioWarningNoSignalMessage` | We're not detecting any sound. Check that your microphone is active. | No estamos detectando sonido. Verifica que tu micrófono esté activo. |
|
|
494
|
+
| `audioWarningLowSignalTitle` | Audio is very quiet | Audio muy bajo |
|
|
495
|
+
| `audioWarningLowSignalMessage` | Move closer to the microphone or turn up the input volume. | Acércate al micrófono o sube el volumen de entrada. |
|
|
496
|
+
| `audioWarningSpeakingMutedTitle` | You're speaking while muted | Estás hablando muteado |
|
|
497
|
+
| `audioWarningSpeakingMutedMessage` | Unmute your microphone if you want your voice in the recording. | Activa el micrófono si quieres que tu voz se escuche en la grabación. |
|
|
498
|
+
| `audioWarningTrackEndedTitle` | Microphone disconnected | Micrófono desconectado |
|
|
499
|
+
| `audioWarningTrackEndedMessage` | The microphone was disconnected. Reconnect it before continuing. | Se desconectó el micrófono. Reconéctalo antes de continuar. |
|
|
500
|
+
| `audioWarningNoChunksTitle` | No microphone input | Sin entrada del micrófono |
|
|
501
|
+
| `audioWarningNoChunksMessage` | We're not receiving audio from the microphone. Check browser permissions. | No estamos recibiendo audio del micrófono. Revisa los permisos del navegador. |
|
|
502
|
+
| `audioWarningTrackMutedTitle` | Microphone muted by browser | Micrófono silenciado por el navegador |
|
|
503
|
+
| `audioWarningTrackMutedMessage` | The browser muted your microphone. Check site settings. | El navegador silenció tu micrófono. Revisa la configuración del sitio. |
|
|
504
|
+
| `audioWarningDismiss` | Dismiss | Cerrar |
|
|
505
|
+
| `cameraErrorTitle` | Camera unavailable | Cámara no disponible |
|
|
506
|
+
| `cameraErrorMessage` | We couldn't access your camera. It may be in use by another app. Please close it and try again. | No pudimos acceder a tu cámara. Puede estar en uso por otra app. Ciérrala e inténtalo de nuevo. |
|
|
507
|
+
| `browserErrorTitle` | Browser not supported | Navegador no compatible |
|
|
508
|
+
| `browserErrorMessage` | Your browser doesn't support video recording. Please use the latest version of Chrome for the best experience. | Tu navegador no es compatible con la grabación de video. Por favor usa la última versión de Chrome. |
|
|
509
|
+
| `recordingCodecUnsupportedTitle` | Recording format not supported | Formato de grabación no compatible |
|
|
510
|
+
| `recordingCodecUnsupportedMessage` | This device can't use the selected video format. Close other apps, update Chrome if possible, and record again. | Este dispositivo no puede usar el formato de video seleccionado. Cierra otras apps, actualiza Chrome si es posible y vuelve a grabar. |
|
|
511
|
+
| `recordingMediaEmptyTitle` | No video was produced | No se generó ningún video |
|
|
512
|
+
| `recordingMediaEmptyMessage` | The browser didn't produce a usable video. Check your camera and record again. | El navegador no produjo un video utilizable. Verifica la cámara y vuelve a grabar. |
|
|
513
|
+
| `recordingMediaErrorTitle` | Recording could not be finished | No se pudo finalizar la grabación |
|
|
514
|
+
| `recordingMediaErrorMessage` | The browser reported an error before the video was ready to upload. Record again. | El navegador informó un error antes de preparar el video para subirlo. Vuelve a grabar. |
|
|
515
|
+
| `recordingServerTranscodeFallbackTitle` | Video processing failed | No se pudo procesar el video |
|
|
516
|
+
| `recordingServerTranscodeFallbackMessage` | We couldn't prepare this video for upload on your device. Record again. | No pudimos preparar este video para subirlo en tu dispositivo. Vuelve a grabar. |
|
|
517
|
+
| `recordingTrackEndedTitle` | Camera stopped during recording | La cámara se detuvo durante la grabación |
|
|
518
|
+
| `recordingTrackEndedMessage` | The camera feed ended before the recording finished. Check that the camera is still connected and record again. | La señal de la cámara terminó antes de finalizar la grabación. Verifica que la cámara siga conectada y vuelve a grabar. |
|
|
519
|
+
| `recordingFinalizeTimeoutTitle` | Recording took too long to finish | La grabación tardó demasiado en finalizar |
|
|
520
|
+
| `recordingFinalizeTimeoutMessage` | This device may be low on memory or processing power. Close other apps or browser tabs, then record again. | Es posible que este dispositivo tenga poca memoria o potencia de procesamiento. Cierra otras apps o pestañas del navegador y vuelve a grabar. |
|
|
521
|
+
| `recordingStateRaceTitle` | Recording did not start correctly | La grabación no inició correctamente |
|
|
522
|
+
| `recordingStateRaceMessage` | The recording could not be finalized because it did not start cleanly. Please refresh the page and record again. | No se pudo finalizar la grabación porque no inició correctamente. Actualiza la página y vuelve a grabar. |
|
|
523
|
+
| `recordingNoFramesTitle` | No video was captured | No se capturó video |
|
|
524
|
+
| `recordingNoFramesMessage` | We couldn't receive video frames from the camera. Check your camera connection and record again. | No pudimos recibir fotogramas de video de la cámara. Verifica la conexión de la cámara y vuelve a grabar. |
|
|
525
|
+
| `recordingUnsupportedTitle` | Recording not available | Grabación no disponible |
|
|
526
|
+
| `recordingUnsupportedMessage` | This device or browser can't record video reliably right now. Check your connection, update Chrome if possible, or use another device. | Este dispositivo o navegador no puede grabar video de forma estable ahora. Revisa tu conexión, actualiza Chrome si es posible o usa otro dispositivo. |
|
|
527
|
+
| `recordingPipelineRetry` | Record again | Grabar de nuevo |
|
|
528
|
+
| `genericErrorTitle` | Something went wrong | Algo salió mal |
|
|
529
|
+
| `genericErrorMessage` | An unexpected error occurred. Please try again. | Ocurrió un error inesperado. Por favor inténtalo de nuevo. |
|
|
530
|
+
| `errorRetry` | Try again | Intentar de nuevo |
|
|
375
531
|
| `switchingDevice` | Switching device... | Cambiando dispositivo... |
|
|
376
532
|
| `recordingStartsIn` | Recording starts in... | La grabación comienza en... |
|
|
377
533
|
| `switchingSource` | Switching source... | Cambiando fuente... |
|
|
@@ -379,7 +535,6 @@ function App() {
|
|
|
379
535
|
| `settings` | Settings | Configuración |
|
|
380
536
|
| `record` | Record | Grabar |
|
|
381
537
|
| `stop` | Stop | Detener |
|
|
382
|
-
| `minimumRecordingTimeNotReached` | You have not met the minimum recording time yet | Aun no cumples el tiempo minimo de grabacion |
|
|
383
538
|
| `pause` | Pause | Pausar |
|
|
384
539
|
| `resume` | Resume | Reanudar |
|
|
385
540
|
| `mute` | Mute | Silenciar |
|
|
@@ -387,11 +542,55 @@ function App() {
|
|
|
387
542
|
| `switchSource` | Switch Source | Cambiar Fuente |
|
|
388
543
|
| `camera` | Camera | Cámara |
|
|
389
544
|
| `microphone` | Microphone | Micrófono |
|
|
545
|
+
| `microphoneConnecting` | Connecting microphone... | Conectando micrófono... |
|
|
546
|
+
| `minimumRecordingTimeNotReached` | You have not met the minimum recording time yet | Aun no cumples el tiempo minimo de grabacion |
|
|
390
547
|
| `uploading` | Uploading... | Subiendo... |
|
|
548
|
+
| `finalizing` | Finalizing… | Finalizando… |
|
|
549
|
+
| `retryingUpload` | Retrying upload... | Reintentando subida... |
|
|
550
|
+
| `uploadInsufficientCredits` | This video couldn't be uploaded. Please contact the site administrator. | No se pudo subir el video. Contacta al administrador del sitio. |
|
|
551
|
+
| `uploadInsufficientCreditsTitle` | Video couldn't be uploaded | No se pudo subir el video |
|
|
552
|
+
| `uploadErrorClose` | Close | Cerrar |
|
|
553
|
+
| `finishing` | Finishing... | Finalizando... |
|
|
554
|
+
| `userInAnotherTab` | User in another tab | Usuario en otra pestaña |
|
|
555
|
+
| `download` | Download | Descargar |
|
|
556
|
+
| `nativeCameraSelectVideo` | Select Video from Gallery | Seleccionar Video de la Galería |
|
|
557
|
+
| `nativeCameraRecordVideo` | Record with Camera | Grabar con Cámara |
|
|
558
|
+
| `nativeCameraProcessing` | Processing video... | Procesando video... |
|
|
559
|
+
| `nativeCameraConfigLoading` | Loading settings... | Cargando configuración... |
|
|
560
|
+
| `nativeCameraConfigLoadError` | Failed to load settings | No se pudo cargar la configuración |
|
|
561
|
+
| `nativeCameraPreviewAlt` | Video preview | Vista previa del video |
|
|
562
|
+
| `errorTitle` | Configuration Error | Error de Configuración |
|
|
563
|
+
| `errorApiKeyRequired` | An API Key or access token provider is required. | Se requiere una API Key o un proveedor de token de acceso. |
|
|
564
|
+
| `errorGeneric` | An error occurred while initializing the recorder | Ocurrió un error al inicializar la grabadora |
|
|
565
|
+
| `mobileOpenCamera` | Allow Access | Permitir Acceso |
|
|
566
|
+
| `mobileOpenCameraTitle` | Camera & Microphone | Cámara y Micrófono |
|
|
567
|
+
| `mobileOpenCameraDescription` | We need access to your camera and microphone to start recording | Necesitamos acceso a tu cámara y micrófono para comenzar a grabar |
|
|
568
|
+
| `mobileCloseCamera` | Close | Cerrar |
|
|
569
|
+
| `mobileHideRecordingPrompt` | Hide prompt | Ocultar pregunta |
|
|
570
|
+
| `mobileShowRecordingPrompt` | Show prompt | Mostrar pregunta |
|
|
571
|
+
| `mobilePermissionDenied` | Camera Access Denied | Acceso a Cámara Denegado |
|
|
572
|
+
| `mobilePermissionDeniedDescription` | Please allow camera access in your browser settings to record video. | Por favor permite el acceso a la cámara en la configuración de tu navegador para grabar video. |
|
|
573
|
+
| `permissionFlowTitle` | Set Up Your Camera | Configurar tu Cámara |
|
|
574
|
+
| `permissionFlowCameraTitle` | Camera & Microphone | Cámara y Micrófono |
|
|
575
|
+
| `permissionFlowMicrophoneTitle` | Camera & Microphone | Cámara y Micrófono |
|
|
576
|
+
| `permissionFlowCameraLabel` | We need access to your camera and microphone to start recording | Necesitamos acceso a tu cámara y micrófono para comenzar a grabar |
|
|
577
|
+
| `permissionFlowMicrophoneLabel` | We need access to your camera and microphone to start recording | Necesitamos acceso a tu cámara y micrófono para comenzar a grabar |
|
|
578
|
+
| `permissionFlowStatusPending` | Pending | Pendiente |
|
|
579
|
+
| `permissionFlowStatusGranted` | Ready | Listo |
|
|
580
|
+
| `permissionFlowStatusDenied` | Blocked | Bloqueado |
|
|
581
|
+
| `permissionFlowStatusRequesting` | Click "Allow" in the browser popup above | Haz clic en "Permitir" en el aviso del navegador |
|
|
582
|
+
| `permissionFlowAllowCamera` | Allow Access | Permitir Acceso |
|
|
583
|
+
| `permissionFlowAllowMicrophone` | Allow Access | Permitir Acceso |
|
|
584
|
+
| `permissionFlowRetry` | Try Again | Reintentar |
|
|
585
|
+
| `permissionFlowRecoveryTitle` | Allow access to continue | Permite el acceso para continuar |
|
|
586
|
+
| `permissionFlowRecoveryInstructions` | Open your browser settings and allow camera and microphone access, then try again. | Abre la configuración de tu navegador y permite el acceso a la cámara y micrófono, luego intenta de nuevo. |
|
|
587
|
+
| `permissionFlowConnecting` | Setting up... | Preparando... |
|
|
588
|
+
|
|
589
|
+
`TranslationKeys` lists every available key.
|
|
391
590
|
|
|
392
591
|
### TypeScript Support
|
|
393
592
|
|
|
394
|
-
The package exports types for better type safety
|
|
593
|
+
The package exports types for better type safety, including `PartialTranslations`, `TranslationKeys`, `RecordingUploadResult`, `UploadErrorCode`, `UploadProgressPhase`, and `AccessTokenProvider`. It also re-exports `getUploadErrorCode`, `UPLOAD_ERROR_INSUFFICIENT_CREDITS`, `isCredentialConflictError` and `CONFIG_ERROR_CREDENTIAL_CONFLICT` from `@vidtreo/recorder`.
|
|
395
594
|
|
|
396
595
|
```tsx
|
|
397
596
|
import VidtreoRecorder from '@vidtreo/recorder-react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AudioWarning, AudioWarning as AudioWarning$1, RecorderController, RecordingState, RecordingState as RecordingState$1, SourceType, SourceType as SourceType$1 } from "@vidtreo/recorder";
|
|
1
|
+
import { AccessTokenProvider, AccessTokenProvider as AccessTokenProvider$1, AudioWarning, AudioWarning as AudioWarning$1, CONFIG_ERROR_CREDENTIAL_CONFLICT, ERROR_PICTURE_IN_PICTURE_UNSUPPORTED, ERROR_SCREEN_SELECTION_CANCELLED, LocalRecording, LocalRecording as LocalRecording$1, PictureInPictureConfig, PictureInPictureConfig as PictureInPictureConfig$1, PictureInPictureConfigInput, PictureInPictureConfigInput as PictureInPictureConfigInput$1, PictureInPicturePlacement, PictureInPicturePoint, PictureInPicturePosition, PictureInPictureShape, RecorderController, RecordingState, RecordingState as RecordingState$1, RecordingUploadResult, RecordingUploadResult as RecordingUploadResult$1, SourceType, SourceType as SourceType$1, UPLOAD_ERROR_INSUFFICIENT_CREDITS, UploadErrorCode, UploadErrorCode as UploadErrorCode$1, UploadProgressPhase, UploadProgressPhase as UploadProgressPhase$1, getUploadErrorCode, isCredentialConflictError, isPictureInPictureSupported } from "@vidtreo/recorder";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/i18n/translations.d.ts
|
|
@@ -49,6 +49,10 @@ type TranslationKeys = {
|
|
|
49
49
|
browserErrorMessage: string;
|
|
50
50
|
recordingCodecUnsupportedTitle: string;
|
|
51
51
|
recordingCodecUnsupportedMessage: string;
|
|
52
|
+
recordingMediaEmptyTitle: string;
|
|
53
|
+
recordingMediaEmptyMessage: string;
|
|
54
|
+
recordingMediaErrorTitle: string;
|
|
55
|
+
recordingMediaErrorMessage: string;
|
|
52
56
|
recordingServerTranscodeFallbackTitle: string;
|
|
53
57
|
recordingServerTranscodeFallbackMessage: string;
|
|
54
58
|
recordingTrackEndedTitle: string;
|
|
@@ -82,7 +86,11 @@ type TranslationKeys = {
|
|
|
82
86
|
microphoneConnecting: string;
|
|
83
87
|
minimumRecordingTimeNotReached: string;
|
|
84
88
|
uploading: string;
|
|
89
|
+
finalizing: string;
|
|
85
90
|
retryingUpload: string;
|
|
91
|
+
uploadInsufficientCredits: string;
|
|
92
|
+
uploadInsufficientCreditsTitle: string;
|
|
93
|
+
uploadErrorClose: string;
|
|
86
94
|
finishing: string;
|
|
87
95
|
userInAnotherTab: string;
|
|
88
96
|
download: string;
|
|
@@ -90,6 +98,8 @@ type TranslationKeys = {
|
|
|
90
98
|
nativeCameraRecordVideo: string;
|
|
91
99
|
nativeCameraProcessing: string;
|
|
92
100
|
nativeCameraConfigLoading: string;
|
|
101
|
+
nativeCameraConfigLoadError: string;
|
|
102
|
+
nativeCameraPreviewAlt: string;
|
|
93
103
|
errorTitle: string;
|
|
94
104
|
errorApiKeyRequired: string;
|
|
95
105
|
errorGeneric: string;
|
|
@@ -115,7 +125,6 @@ type TranslationKeys = {
|
|
|
115
125
|
permissionFlowRetry: string;
|
|
116
126
|
permissionFlowRecoveryTitle: string;
|
|
117
127
|
permissionFlowRecoveryInstructions: string;
|
|
118
|
-
permissionFlowRecoveryGuideHint: string;
|
|
119
128
|
permissionFlowConnecting: string;
|
|
120
129
|
};
|
|
121
130
|
type PartialTranslations = Partial<TranslationKeys>;
|
|
@@ -159,11 +168,8 @@ type BaseRecorderProps = {
|
|
|
159
168
|
texts?: PartialTranslations; /** @deprecated Use mobileMode instead */
|
|
160
169
|
nativeCamera?: boolean; /** Controls mobile recording experience. Default: "overlay" */
|
|
161
170
|
mobileMode?: MobileMode;
|
|
162
|
-
onUploadComplete?: (result:
|
|
163
|
-
|
|
164
|
-
uploadUrl: string;
|
|
165
|
-
}) => void;
|
|
166
|
-
onUploadProgress?: (progress: number) => void;
|
|
171
|
+
onUploadComplete?: (result: RecordingUploadResult$1) => void;
|
|
172
|
+
onUploadProgress?: (progress: number, phase: UploadProgressPhase$1 | null) => void;
|
|
167
173
|
onUploadError?: (error: Error) => void;
|
|
168
174
|
onRecordingStart?: () => void;
|
|
169
175
|
onRecordingStop?: () => void;
|
|
@@ -173,14 +179,22 @@ type BaseRecorderProps = {
|
|
|
173
179
|
type DemoModeProps = BaseRecorderProps & {
|
|
174
180
|
demo: true;
|
|
175
181
|
apiKey?: string;
|
|
182
|
+
getAccessToken?: never;
|
|
176
183
|
};
|
|
177
|
-
type
|
|
184
|
+
type ApiKeyProductionModeProps = BaseRecorderProps & {
|
|
178
185
|
demo?: false;
|
|
179
186
|
apiKey: string;
|
|
187
|
+
getAccessToken?: never;
|
|
180
188
|
};
|
|
181
|
-
type
|
|
189
|
+
type AccessTokenProductionModeProps = BaseRecorderProps & {
|
|
190
|
+
demo?: false;
|
|
191
|
+
apiKey?: never;
|
|
192
|
+
getAccessToken: AccessTokenProvider$1;
|
|
193
|
+
};
|
|
194
|
+
type VidtreoRecorderProps = DemoModeProps | ApiKeyProductionModeProps | AccessTokenProductionModeProps;
|
|
182
195
|
type UseVidtreoRecorderConfig = {
|
|
183
|
-
apiKey
|
|
196
|
+
apiKey?: string;
|
|
197
|
+
getAccessToken?: AccessTokenProvider$1;
|
|
184
198
|
backendUrl?: string;
|
|
185
199
|
countdownDuration?: number;
|
|
186
200
|
minTimeRecord?: number;
|
|
@@ -195,16 +209,18 @@ type UseVidtreoRecorderConfig = {
|
|
|
195
209
|
enableTabVisibilityOverlay?: boolean;
|
|
196
210
|
tabVisibilityOverlayText?: string;
|
|
197
211
|
proxyEndpoint?: string;
|
|
198
|
-
demo?: boolean;
|
|
212
|
+
demo?: boolean;
|
|
213
|
+
pictureInPicture?: PictureInPictureConfig$1;
|
|
214
|
+
startScreenWithoutCamera?: boolean;
|
|
215
|
+
captureSystemAudio?: boolean;
|
|
216
|
+
autoUpload?: boolean; /** @deprecated Use mobileMode instead */
|
|
199
217
|
nativeCamera?: boolean; /** Controls mobile recording experience. Default: "overlay" */
|
|
200
218
|
mobileMode?: MobileMode;
|
|
201
219
|
lang?: string;
|
|
202
220
|
texts?: PartialTranslations;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}) => void;
|
|
207
|
-
onUploadProgress?: (progress: number) => void;
|
|
221
|
+
onRecordingReady?: (recording: LocalRecording$1) => void;
|
|
222
|
+
onUploadComplete?: (result: RecordingUploadResult$1) => void;
|
|
223
|
+
onUploadProgress?: (progress: number, phase: UploadProgressPhase$1 | null) => void;
|
|
208
224
|
onUploadError?: (error: Error) => void;
|
|
209
225
|
onRecordingStart?: () => void;
|
|
210
226
|
onRecordingStop?: () => void;
|
|
@@ -214,8 +230,11 @@ type UseVidtreoRecorderConfig = {
|
|
|
214
230
|
type VidtreoRecorderState = {
|
|
215
231
|
recordingState: RecordingState$1;
|
|
216
232
|
stream: MediaStream | null;
|
|
233
|
+
sourceType: SourceType$1;
|
|
234
|
+
cameraStream: MediaStream | null;
|
|
217
235
|
isMuted: boolean;
|
|
218
236
|
isPaused: boolean;
|
|
237
|
+
isFinalizingRecording: boolean;
|
|
219
238
|
isAudioReady: boolean;
|
|
220
239
|
hasAudioFailed: boolean;
|
|
221
240
|
error: string | null;
|
|
@@ -225,7 +244,9 @@ type VidtreoRecorderState = {
|
|
|
225
244
|
countdown: number | null;
|
|
226
245
|
timer: string;
|
|
227
246
|
uploadProgress: number | null;
|
|
247
|
+
uploadPhase: UploadProgressPhase$1 | null;
|
|
228
248
|
uploadRetryAttempt: number | null;
|
|
249
|
+
uploadErrorCode: UploadErrorCode$1 | null;
|
|
229
250
|
transcodingProgress: number | null;
|
|
230
251
|
transitionMessage: string | null;
|
|
231
252
|
isInitialized: boolean;
|
|
@@ -240,17 +261,23 @@ type VidtreoRecorderState = {
|
|
|
240
261
|
};
|
|
241
262
|
};
|
|
242
263
|
type VidtreoRecorderActions = {
|
|
243
|
-
startRecording: (sourceType?: SourceType$1
|
|
264
|
+
startRecording: (sourceType?: SourceType$1, options?: {
|
|
265
|
+
skipCountdown?: boolean;
|
|
266
|
+
}) => Promise<void>;
|
|
244
267
|
stopRecording: () => Promise<RecordingStopResult>;
|
|
245
268
|
pauseRecording: () => void;
|
|
246
269
|
resumeRecording: () => void;
|
|
247
270
|
toggleMute: () => void;
|
|
248
271
|
switchSource: (sourceType: SourceType$1) => Promise<void>;
|
|
272
|
+
reselectScreenSource: () => Promise<boolean>;
|
|
249
273
|
changeCamera: (deviceId: string) => Promise<void>;
|
|
250
274
|
changeMic: (deviceId: string) => Promise<void>;
|
|
251
275
|
startPreview: (sourceType?: SourceType$1) => Promise<void>;
|
|
252
276
|
stopPreview: () => void;
|
|
253
277
|
downloadVideo: () => void;
|
|
278
|
+
clearUploadError: () => void;
|
|
279
|
+
setRecordingTitle: (title: string | null) => void;
|
|
280
|
+
setPictureInPicture: (update: PictureInPictureConfigInput$1) => void;
|
|
254
281
|
cleanup: () => void;
|
|
255
282
|
};
|
|
256
283
|
type RecordingStopResult = {
|
|
@@ -271,4 +298,4 @@ declare function VidtreoRecorder(props: VidtreoRecorderProps): React.JSX.Element
|
|
|
271
298
|
//#region src/hooks/use-vidtreo-recorder.d.ts
|
|
272
299
|
declare function useVidtreoRecorder(config: UseVidtreoRecorderConfig): UseVidtreoRecorderReturn;
|
|
273
300
|
//#endregion
|
|
274
|
-
export { type AudioWarning, MobileMode, type PartialTranslations, RecordingPrompt, RecordingPromptCountdown, RecordingPromptCountdownPlacement, type RecordingState, RecordingStopResult, type SourceType, type TranslationKeys, UseVidtreoRecorderConfig, UseVidtreoRecorderReturn, VidtreoRecorder, VidtreoRecorder as VidtreoRecorderSSR, VidtreoRecorderActions, VidtreoRecorderProps, VidtreoRecorderState, useVidtreoRecorder };
|
|
301
|
+
export { type AccessTokenProvider, type AudioWarning, CONFIG_ERROR_CREDENTIAL_CONFLICT, ERROR_PICTURE_IN_PICTURE_UNSUPPORTED, ERROR_SCREEN_SELECTION_CANCELLED, type LocalRecording, MobileMode, type PartialTranslations, type PictureInPictureConfig, type PictureInPictureConfigInput, type PictureInPicturePlacement, type PictureInPicturePoint, type PictureInPicturePosition, type PictureInPictureShape, RecordingPrompt, RecordingPromptCountdown, RecordingPromptCountdownPlacement, type RecordingState, RecordingStopResult, type RecordingUploadResult, type SourceType, type TranslationKeys, UPLOAD_ERROR_INSUFFICIENT_CREDITS, type UploadErrorCode, type UploadProgressPhase, UseVidtreoRecorderConfig, UseVidtreoRecorderReturn, VidtreoRecorder, VidtreoRecorder as VidtreoRecorderSSR, VidtreoRecorderActions, VidtreoRecorderProps, VidtreoRecorderState, getUploadErrorCode, isCredentialConflictError, isPictureInPictureSupported, useVidtreoRecorder };
|