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 +72 -36
- package/dist/cjs/index.cjs +198 -104
- package/dist/esm/index.js +124 -82
- package/dist/esm/types/events/params.d.ts +1 -0
- package/dist/esm/util/isVirtualCamera.d.ts +1 -1
- package/dist/esm/wrappers/form.d.ts +3 -0
- package/dist/esm/wrappers/visuals/notifier.d.ts +1 -1
- package/dist/esm/wrappers/visuals/recorder/capture.d.ts +1 -0
- package/dist/esm/wrappers/visuals.d.ts +5 -2
- package/dist/umd/index.js +155 -100
- package/package.json +5 -5
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
|
-
|
|
16
|
+
Bring Sign Language to your contact forms. ✉
|
|
17
17
|
|
|
18
|
-
|
|
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
|
-
|
|
45
|
+
Try the full experience at [videomail.io](https://videomail.io).
|
|
40
46
|
|
|
41
|
-
|
|
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
|
|
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
|
-
`
|
|
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
|
-
//
|
|
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
|
|
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
|
|
143
|
+
Videomail errors extend the native `Error` class with details for troubleshooting.
|
|
138
144
|
|
|
139
145
|
### videomailClient.show()
|
|
140
146
|
|
|
141
|
-
|
|
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
|
|
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
|
|
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
|
|
172
|
+
Recovery events:
|
|
156
173
|
|
|
157
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
202
|
+
Returns a videomail asynchronously for the given alias. Find the alias in:
|
|
184
203
|
|
|
185
|
-
1. The
|
|
186
|
-
2. The `SUBMITTED` event
|
|
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
|
-
|
|
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
|
|
225
|
+
Hides the UI without unloading it.
|
|
207
226
|
|
|
208
227
|
### videomailClient.isDirty()
|
|
209
228
|
|
|
210
|
-
Returns `true` when a video has been
|
|
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
|
-
|
|
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
|
|
247
|
+
Returns recent log lines if your logger collects them.
|
|
227
248
|
|
|
228
249
|
### videomailClient.setLimitSeconds(limitSeconds)
|
|
229
250
|
|
|
230
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
379
|
+
Make Sign Language at home in email and web forms. That's what we're here for.
|