@vonage/client-sdk-video 2.28.3 → 2.28.4

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
@@ -1,19 +1,19 @@
1
- # OpenTok.js
1
+ # Vonage Video API
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40opentok%2Fclient.svg)](https://badge.fury.io/js/%40opentok%2Fclient)
3
+ [![npm version](https://badge.fury.io/js/%40vonage%2Fclient-sdk-video.svg)](https://badge.fury.io/js/%40vonage%2Fclient-sdk-video)
4
4
 
5
- The OpenTok.js library lets you use OpenTok-powered video sessions on the web.
5
+ The Vonage Video API library lets you use Vonage-powered video sessions on the web.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  ```sh
10
- yarn add @opentok/client
10
+ yarn add @vonage/client-sdk-video
11
11
  ```
12
12
 
13
13
  or
14
14
 
15
15
  ```sh
16
- npm install --save @opentok/client
16
+ npm install --save @vonage/client-sdk-video
17
17
  ```
18
18
 
19
19
  ## Usage
@@ -25,11 +25,11 @@ The library is bundled as a standalone UMD module so it is CommonJS compatible.
25
25
  Create your application file `app.js`:
26
26
 
27
27
  ```js
28
- const OT = require('@opentok/client');
28
+ const OT = require('@vonage/client-sdk-video');
29
29
  const publisher = OT.initPublisher();
30
30
  ```
31
31
 
32
- Bundle the application with your favourite bundler. For browserify just run:
32
+ Bundle the application with your favorite bundler. For browserify just run:
33
33
 
34
34
  ```sh
35
35
  browserify app.js > bundle.js
@@ -50,14 +50,14 @@ Include the `dist/js/opentok.min.js` script in your webpage.
50
50
  Then use the `OT` object exposed in the global scope.
51
51
 
52
52
  ```html
53
- <script src="node_modules/@opentok/client/dist/js/opentok.min.js"></script>
53
+ <script src="node_modules/@vonage/client-sdk-video/dist/js/opentok.min.js"></script>
54
54
  <script>
55
55
  const publisher = OT.initPublisher();
56
56
  </script>
57
57
  ```
58
58
 
59
- *Note:* OpenTok.js automatically loads CSS and image files from the TokBox CDN when included in a webpage.
59
+ *Note:* Vonage Video API automatically loads CSS and image files from the TokBox CDN when included in a webpage.
60
60
 
61
61
  ## Documentation
62
62
 
63
- The API reference and tutorials can be found at https://tokbox.com/developer/sdks/js/
63
+ The API reference and tutorials can be found at https://developer.vonage.com/en/video/client-sdks/web/overview
@@ -268,6 +268,85 @@ declare namespace OT {
268
268
  context?: object
269
269
  ): void;
270
270
  }
271
+
272
+ // This class is a modified copy of OTEventEmitter that was needed in order to support the template string used for the signal:type event
273
+ class SessionOTEventEmitter<EventMap> {
274
+ on<EventName extends keyof EventMap>(
275
+ eventName: EventName,
276
+ callback: (event: EventMap[EventName]) => void,
277
+ context?: object
278
+ ): void;
279
+
280
+ on(
281
+ eventName: `signal:${string}`,
282
+ callback: (event: Event<`signal:${string}`, Session> & {
283
+ type?: string;
284
+ data?: string;
285
+ from: Connection | null;
286
+ }) => void,
287
+ context?: object
288
+ ): void;
289
+
290
+ on(
291
+ eventName: string,
292
+ callback: (event: Event<string, any>) => void,
293
+ context?: object
294
+ ): void;
295
+
296
+ on(
297
+ eventMap: object,
298
+ context?: object
299
+ ): void;
300
+
301
+ once<EventName extends keyof EventMap>(
302
+ eventName: EventName,
303
+ callback: (event: EventMap[EventName]) => void,
304
+ context?: object
305
+ ): void;
306
+
307
+ once(
308
+ eventName: `signal:${string}`,
309
+ callback: (event: Event<`signal:${string}`, Session> & {
310
+ type?: string;
311
+ data?: string;
312
+ from: Connection | null;
313
+ }) => void,
314
+ context?: object
315
+ ): void;
316
+
317
+ once(
318
+ eventName: string,
319
+ callback: (event: Event<string, any>) => void,
320
+ context?: object
321
+ ): void;
322
+
323
+ once(
324
+ eventMap: object,
325
+ context?: object
326
+ ): void;
327
+
328
+ off<EventName extends keyof EventMap>(
329
+ eventName?: EventName,
330
+ callback?: (event: EventMap[EventName]) => void,
331
+ context?: object
332
+ ): void;
333
+
334
+ off(
335
+ eventName: `signal:${string}`,
336
+ context?: object
337
+ ): void;
338
+
339
+ off(
340
+ eventName?: string,
341
+ callback?: (event: Event<string, any>) => void,
342
+ context?: object
343
+ ): void;
344
+
345
+ off(
346
+ eventMap: object,
347
+ context?: object
348
+ ): void;
349
+ }
271
350
 
272
351
  export class Publisher extends OTEventEmitter<{
273
352
  accessAllowed: Event<'accessAllowed', Publisher>;
@@ -384,7 +463,7 @@ declare namespace OT {
384
463
  context?: object
385
464
  ): void;
386
465
 
387
- export class Session extends OTEventEmitter<{
466
+ export class Session extends SessionOTEventEmitter<{
388
467
  archiveStarted: Event<'archiveStarted', Session> & {
389
468
  id: string;
390
469
  name: string;
@@ -597,7 +676,7 @@ declare namespace OT {
597
676
  getAudioVolume(): number;
598
677
  getImgData(): string | null;
599
678
  getStats(callback: (error?: OTError, stats?: SubscriberStats) => void): void;
600
- getRtcStatsReport(): Promise<RTCStatsReport>;
679
+ getRtcStatsReport(): Promise<Map<string, any>>;
601
680
  subscribeToCaptions(value: boolean): Promise<void>;
602
681
  isSubscribedToCaptions(): boolean;
603
682
  isAudioBlocked(): boolean;