videomail-client 16.4.1 → 16.6.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 CHANGED
@@ -13,9 +13,15 @@
13
13
  [netlify-image]: https://api.netlify.com/api/v1/badges/3c9df5b4-8b85-4081-950a-d5df2dbd9926/deploy-status
14
14
  [netlify-url]: https://app.netlify.com/sites/videomail-client/deploys
15
15
 
16
- Record webcam videos in contact forms.
16
+ Bring Sign Language to your contact forms. ✉
17
17
 
18
- The client captures image frames with `navigator.mediaDevices.getUserMedia()`, streams them to the Videomail service over WebSocket, and receives an encoded video. No browser plugins are required. The package includes ESM, CommonJS, UMD, and TypeScript declaration builds.
18
+ Record webcam videos without browser plugins:
19
+
20
+ - Capture frames with `navigator.mediaDevices.getUserMedia()`.
21
+ - Stream them to Videomail over WebSocket.
22
+ - Get an encoded video back.
23
+
24
+ Made for Deaf users, and for hearing users learning Sign Language. The package includes ESM, CommonJS, UMD, and TypeScript declaration builds.
19
25
 
20
26
  - [Live demo](#live-demo)
21
27
  - [Storybook examples](#storybook-examples)
@@ -36,9 +42,9 @@ Try it at [videomail-client.netlify.app](https://videomail-client.netlify.app).
36
42
 
37
43
  ### Real-world usage
38
44
 
39
- There is a full version with all its features on [videomail.io](https://videomail.io).
45
+ Try the full experience at [videomail.io](https://videomail.io).
40
46
 
41
- And there is more:
47
+ You can also find it on:
42
48
 
43
49
  - [https://wfdeaf.org/contact](https://wfdeaf.org/contact)
44
50
  - [https://www.deaf.org.nz/contact](https://www.deaf.org.nz/contact)
@@ -46,7 +52,7 @@ And there is more:
46
52
 
47
53
  ## Storybook examples
48
54
 
49
- To check out some examples in your browser locally, just run these two commands:
55
+ To try the examples locally:
50
56
 
51
57
  1. `npm install`
52
58
  2. `npm run storybook`
@@ -114,7 +120,7 @@ const videomailClient = new VideomailClient({
114
120
 
115
121
  ### videomailClient.on()
116
122
 
117
- `VideomailClient` provides an event-emitter-style API. `on()` returns an unsubscribe function:
123
+ Use `on()` to listen for events. It returns an unsubscribe function:
118
124
 
119
125
  ```ts
120
126
  videomailClient.on("FORM_READY", () => {
@@ -122,7 +128,7 @@ videomailClient.on("FORM_READY", () => {
122
128
  });
123
129
 
124
130
  videomailClient.on("SUBMITTED", ({ videomail, response }) => {
125
- // Continue with application-specific submission handling.
131
+ // Handle the submitted video in your app.
126
132
  });
127
133
  ```
128
134
 
@@ -132,13 +138,13 @@ Check them out at [src/types/events/index.ts](https://github.com/binarykitchen/v
132
138
 
133
139
  Some events include typed parameters exported by the package.
134
140
 
135
- The client includes default visual error handling. Applications can also subscribe to the `ERROR` event for custom logging or recovery.
141
+ The client shows errors by default. Listen for `ERROR` to add your own logging or recovery.
136
142
 
137
- Videomail errors extend the native `Error` class and include additional diagnostic data.
143
+ Videomail errors extend the native `Error` class with details for troubleshooting.
138
144
 
139
145
  ### videomailClient.show()
140
146
 
141
- Automatically fills the DOM with a form for video recording. By default the HTML element with the ID `videomail` will be filled, see options.
147
+ Adds the recording form to the page. By default, it uses the element with ID `videomail`. You can change this in the [options](#options).
142
148
 
143
149
  ### videomailClient.record()
144
150
 
@@ -146,19 +152,32 @@ Starts recording without requiring the user to press the record button.
146
152
 
147
153
  ### videomailClient.pause()
148
154
 
149
- Pauses an active recording or countdown without discarding it. Idle cameras and unsent previews are left alone. Useful for native applications. To resume, refer to the next function `videomailClient.recoverCamera()`.
155
+ Pauses a recording or countdown without losing it. Leaves idle cameras and unsent previews alone.
156
+
157
+ For native apps, pair this with `videomailClient.recoverCamera()` when the app returns to the foreground.
150
158
 
151
159
  ### videomailClient.recoverCamera()
152
160
 
153
- Returns a `Promise<boolean>` indicating whether camera recovery succeeds. It restores playback for live tracks or requests a replacement stream when camera or microphone tracks have ended. Duplicate calls share the pending recovery. An unbuilt client, unsent preview, encoding, or submission is left alone and returns `false`.
161
+ Returns a `Promise<boolean>`: `true` if camera recovery succeeds.
162
+
163
+ - Restarts playback for live tracks.
164
+ - Requests a new stream if camera or microphone tracks have ended.
165
+ - Shares pending recovery across duplicate calls.
166
+ - Returns `false` without changes if the client is unbuilt, has an unsent preview, is encoding, or is submitting.
167
+
168
+ Recovery keeps frame dimensions, frame/sample counts, and the audio sample rate. It does **not** resume recording or a countdown on its own. The user chooses Resume, which waits for recovery before sending more frames or restarting a paused countdown.
169
+
170
+ With automatic pause enabled, hiding the page pauses recording. Returning to it recovers the camera. Native apps should call `pause()` when backgrounded and `recoverCamera()` when foregrounded. Wire these into your app's lifecycle; no Capacitor dependency is needed. Use recovery, not `startOver()`, to keep a paused take.
154
171
 
155
- Recovery preserves captured frame dimensions, frame/sample counters, and the audio sample rate. Foreground recovery never resumes capture or a countdown automatically. The user must explicitly choose Resume; that action waits for recovery before sending more frames.
172
+ Recovery events:
156
173
 
157
- With automatic pause enabled, browser visibility changes pause capture and recover the camera on return. Native hosts should call `pause()` on background and `recoverCamera()` on foreground through their own lifecycle integration. The client has no Capacitor dependency. Do not call `startOver()` to recover a paused take.
174
+ - `CAMERA_RECOVERING`: recovery has started.
175
+ - `USER_MEDIA_READY` with `recovering: true`: the replacement stream is ready.
176
+ - `CAMERA_RECOVERY_FAILED` with an `err`: access, playback, audio setup, or the recovery deadline failed.
158
177
 
159
- `CAMERA_RECOVERING` signals the start of recovery. `USER_MEDIA_READY` includes `recovering: true` after a replacement stream is initialized. `CAMERA_RECOVERY_FAILED` provides an `err` when access, playback, audio initialization, or the recovery deadline fails. The default notification does not reset the take; the user can retry Resume or stop to keep the recorded part. Stop, reset, unload, and submission cancel pending recovery, and late streams are stopped.
178
+ The default failure notice keeps the take. Users can retry Resume or stop to keep what they recorded. Stop, reset, unload, and submission cancel pending recovery. Streams that arrive after cancellation are stopped.
160
179
 
161
- This does not reconnect a lost recording WebSocket or survive process termination. Physical-device camera and microphone validation remains necessary.
180
+ Recovery cannot reconnect a lost recording WebSocket or keep a take after the app process ends. Test the camera and microphone on physical devices, too.
162
181
 
163
182
  ### videomailClient.replay(videomail[, parentElementId])
164
183
 
@@ -166,13 +185,13 @@ Adds a video player for the supplied videomail.
166
185
 
167
186
  If `replayParentElementId` is supplied, the player is inserted into that element. Otherwise, the client uses or creates a replay container within the configured container.
168
187
 
169
- Also note that, when the parent element already contains a video container like this
188
+ If the parent already has a video element like this:
170
189
 
171
190
  ```html
172
191
  <video class="replay"></video>
173
192
  ```
174
193
 
175
- the client reuses it instead of creating another DOM element.
194
+ The client reuses it. No extra element needed.
176
195
 
177
196
  ### videomailClient.startOver()
178
197
 
@@ -180,10 +199,10 @@ Resets the client and returns it to the ready state so the same instance can rec
180
199
 
181
200
  ### videomailClient.getByAlias(alias)
182
201
 
183
- Returns a videomail asynchronously for the given alias. You can obtain the alias from:
202
+ Returns a videomail asynchronously for the given alias. Find the alias in:
184
203
 
185
- 1. The form submission to your own server has it under `videomail_alias` in the form body.
186
- 2. The `SUBMITTED` event payload.
204
+ 1. The `videomail_alias` field sent to your server.
205
+ 2. The `SUBMITTED` event data.
187
206
 
188
207
  ### videomailClient.getByKey(key)
189
208
 
@@ -199,15 +218,15 @@ Returns the videomail thread containing the given key.
199
218
 
200
219
  ### videomailClient.unload()
201
220
 
202
- Manually unloads the webcam, closes the active WebSocket connection, and removes all internal event listeners.
221
+ Stops the webcam, closes the active WebSocket connection, and removes all internal event listeners.
203
222
 
204
223
  ### videomailClient.hide()
205
224
 
206
- Hides all the visuals (but does not unload anything).
225
+ Hides the UI without unloading it.
207
226
 
208
227
  ### videomailClient.isDirty()
209
228
 
210
- Returns `true` when a video has been recorded but not submitted. This can be used before navigation to warn about an unsent recording.
229
+ Returns `true` when a recorded video has not been submitted. Use it to warn users before they leave an unsent recording.
211
230
 
212
231
  ### videomailClient.isRecording()
213
232
 
@@ -219,21 +238,25 @@ Returns `true` after the client UI has been built and before it is unloaded.
219
238
 
220
239
  ### videomailClient.submit()
221
240
 
222
- Manually triggers submission when the client and form are valid. This is useful when another UI layer owns the visible submit control.
241
+ Submits the form after client validation succeeds.
242
+
243
+ With `enableAutoValidation: false`, no client validation event is needed. Your app must validate the form first. This helps when your app provides its own submit button.
223
244
 
224
245
  ### videomailClient.getLogLines()
225
246
 
226
- Returns the recently collected log lines when the configured logger supports collection.
247
+ Returns recent log lines if your logger collects them.
227
248
 
228
249
  ### videomailClient.setLimitSeconds(limitSeconds)
229
250
 
230
- Updates the recording time limit for subsequent recording activity.
251
+ Changes the time limit for further recording.
231
252
 
232
253
  ## Stored videomail data
233
254
 
234
- The `SUBMITTED` event includes a `videomail` object. The exact response can evolve, but its shape follows the exported `Videomail` type. A shortened example is shown below:
255
+ The `SUBMITTED` event includes a `videomail` object. Its fields may evolve; check the exported `Videomail` type for the current shape.
256
+
257
+ For new recordings, `width` and `height` describe the captured canvas frames. They are not the viewport or resized preview dimensions. They stay available after the camera stops and are replaced when you record again.
235
258
 
236
- For new recordings, submitted `width` and `height` describe the captured canvas frames, not the browser viewport or the resized preview. These dimensions survive stopping the camera and are replaced when recording again.
259
+ Here's a shortened example:
237
260
 
238
261
  ```json
239
262
  {
@@ -276,7 +299,7 @@ You can also retrieve this data with `videomailClient.getByKey()`.
276
299
 
277
300
  ## Form Submissions
278
301
 
279
- How to configure, inject meta data and test form submissions with the Videomail client can be found in [Form Submissions ✏️](./docs/FORM_SUBMISSIONS.md).
302
+ See [Form Submissions ✏️](./docs/FORM_SUBMISSIONS.md) to set up submissions, include metadata, and test your integration.
280
303
 
281
304
  ## Privacy and error reporting
282
305
 
@@ -284,13 +307,26 @@ Read about our privacy and error reporting practices in [Privacy and error repor
284
307
 
285
308
  ## Whitelist
286
309
 
287
- Examples work at [https://localhost:8443](https://localhost:8443) because localhost is allowed by the remote Videomail server. `https://localhost` and `https://localhost:443` are also available for local development. Other origins require their own whitelist entry.
310
+ The examples work locally without extra setup. Videomail allows these development origins:
311
+
312
+ - [https://localhost:8443](https://localhost:8443)
313
+ - `https://localhost`
314
+ - `https://localhost:443`
315
+
316
+ Other origins need their own whitelist entry.
288
317
 
289
318
  For a deployed domain, request access at [videomail.io/whitelist](https://videomail.io/whitelist). You will receive a whitelist key for the approved origins.
290
319
 
291
320
  ## Browser compatibility
292
321
 
293
- Recording requires a secure context (`https://` or localhost) and support for `navigator.mediaDevices.getUserMedia()`, WebSocket, Canvas, and AudioWorklet when audio is enabled. Current evergreen desktop and mobile browsers are supported. Internet Explorer is not supported.
322
+ Recording needs a secure context (`https://` or localhost), plus:
323
+
324
+ - `navigator.mediaDevices.getUserMedia()`
325
+ - WebSocket
326
+ - Canvas
327
+ - AudioWorklet, if audio is enabled
328
+
329
+ Current evergreen desktop and mobile browsers are supported. Internet Explorer is not.
294
330
 
295
331
  See [Can I Use: Media Capture from DOM Elements](https://caniuse.com/stream) and test the [live demo](#live-demo) in the browsers required by your integration.
296
332
 
@@ -304,7 +340,7 @@ It extends the Ninja Forms form builder with a webcam input and submission integ
304
340
 
305
341
  ### Changelog
306
342
 
307
- A separate changelog is not maintained. Use `git log` or the [commit history](https://github.com/binarykitchen/videomail-client/commits/master).
343
+ No separate changelog. Check `git log` or the [commit history](https://github.com/binarykitchen/videomail-client/commits/master).
308
344
 
309
345
  ### Noise
310
346
 
@@ -316,7 +352,7 @@ Videomail in the wild:
316
352
 
317
353
  This is just the beginning. I will add a lot more over time.
318
354
 
319
- Bear with me, there are lots of problems to crack, especially with the performance, audio part and some unit tests are missing. I do not want to waste too much time on perfection unless it's proven to work then I rewrite piece by piece.
355
+ There's still work to do on performance, audio, and test coverage. We improve things piece by piece, rather than chase perfection in one big rewrite.
320
356
 
321
357
  ### Credits
322
358
 
@@ -336,8 +372,8 @@ They all deserve lots of love in return. Thank you so much.
336
372
 
337
373
  ### Code quality
338
374
 
339
- The project prioritizes stability and bug fixes over large rewrites. Its implementation has evolved several times as browser media APIs and integration requirements have changed.
375
+ Stability and bug fixes come before big rewrites. The code keeps evolving with browser media APIs and the apps that use it.
340
376
 
341
377
  ### Final philosophy
342
378
 
343
- The primary goal is to make Sign Language easier to use in email and web forms.
379
+ Make Sign Language at home in email and web forms. That's what we're here for.