@videosdk.live/react-sdk 0.1.88 → 0.1.89

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.
@@ -1,467 +1,490 @@
1
1
  export class Meeting {
2
- /**
3
- * @description
4
- * This represents the meetingId
5
- */
6
- id: string;
7
- /**
8
- * @description
9
- * This represents the `participantId` of the active speaker in the meeting
10
- */
11
- activeSpeakerId?: string;
12
- /**
13
- * @description
14
- * This represents the `participantId` of the active presenter in the meeting
15
- */
16
- activePresenterId?: string;
17
- /**
18
- * @description
19
- * This represents the `participantId` of the main participant in the meeting
20
- */
21
- mainParticipantId: string;
22
- /**
23
- * @deprecated
24
- */
25
- connections: Map<string, Connection>;
26
- /**
27
- * @description
28
- * These represents the `Participant` object for the local participant
29
- */
30
- localParticipant: Participant;
31
- /**
32
- * @description
33
- * These represents the Map of all the Participant objects except local participant
34
- */
35
- participants: Map<string, Participant>;
36
- /**
37
- * @description These represents the current state of the meeting Livestream
38
- */
39
- livestreamState: 'LIVESTREAM_STOPPED' | 'LIVESTREAM_STARTING' | 'LIVESTREAM_STARTED' | 'LIVESTREAM_STOPPING';
40
- /**
41
- * @description These represents the current state of the meeting recording
42
- */
43
- recordingState: 'RECORDING_STOPPED' | 'RECORDING_STARTING' | 'RECORDING_STARTED' | 'RECORDING_STOPPING';
44
- /**
45
- * @description These represents the current state of the meeting HLS
46
- *
47
- */
48
- hlsState: 'HLS_STOPPED' | 'HLS_STARTING' | 'HLS_STARTED' | 'HLS_STOPPING';
49
- /**
50
- * @description These object will provide the URLs to play the HLS streams
51
- */
52
- hlsUrls: {
53
- downstreamUrl?: string;
54
- playbackHlsUrl?: string;
55
- livestreamUrl?: string;
56
- };
57
- /**
58
- * @description These object will contain all the messages send using the `sendChatMessage` method
59
- */
60
- messages: Array<{
61
- message: string;
62
- senderId: string;
63
- senderName: string;
64
- timestamp: Date;
65
- topic: string;
66
- payload: object;
67
- }>;
2
+ /**
3
+ * @description
4
+ * This represents the meetingId
5
+ */
6
+ id: string;
7
+ /**
8
+ * @description
9
+ * This represents the `participantId` of the active speaker in the meeting
10
+ */
11
+ activeSpeakerId?: string;
12
+ /**
13
+ * @description
14
+ * This represents the `participantId` of the active presenter in the meeting
15
+ */
16
+ activePresenterId?: string;
17
+ /**
18
+ * @description
19
+ * This represents the `participantId` of the main participant in the meeting
20
+ */
21
+ mainParticipantId: string;
22
+ /**
23
+ * @deprecated
24
+ */
25
+ connections: Map<string, Connection>;
26
+ /**
27
+ * @description
28
+ * These represents the `Participant` object for the local participant
29
+ */
30
+ localParticipant: Participant;
31
+ /**
32
+ * @description
33
+ * These represents the Map of all the Participant objects except local participant
34
+ */
35
+ participants: Map<string, Participant>;
36
+ /**
37
+ * @description These represents the current state of the meeting Livestream
38
+ */
39
+ livestreamState:
40
+ | 'LIVESTREAM_STOPPED'
41
+ | 'LIVESTREAM_STARTING'
42
+ | 'LIVESTREAM_STARTED'
43
+ | 'LIVESTREAM_STOPPING';
44
+ /**
45
+ * @description These represents the current state of the meeting recording
46
+ */
47
+ recordingState:
48
+ | 'RECORDING_STOPPED'
49
+ | 'RECORDING_STARTING'
50
+ | 'RECORDING_STARTED'
51
+ | 'RECORDING_STOPPING';
52
+ /**
53
+ * @description These represents the current state of the meeting HLS
54
+ *
55
+ */
56
+ hlsState: 'HLS_STOPPED' | 'HLS_STARTING' | 'HLS_STARTED' | 'HLS_STOPPING';
57
+ /**
58
+ * @description These object will provide the URLs to play the HLS streams
59
+ */
60
+ hlsUrls: {
61
+ downstreamUrl?: string;
62
+ playbackHlsUrl?: string;
63
+ livestreamUrl?: string;
64
+ };
65
+ /**
66
+ * @description These represents the current state of the meeting transcription
67
+ */
68
+ transcriptionState:
69
+ | 'TRANSCRIPTION_STOPPED'
70
+ | 'TRANSCRIPTION_STARTING'
71
+ | 'TRANSCRIPTION_STARTED'
72
+ | 'TRANSCRIPTION_STOPPING';
68
73
 
69
- /**
70
- * @description These method is used to join the meeting
71
- */
72
- join(): void;
74
+ /**
75
+ * @description These object will contain all the messages send using the `sendChatMessage` method
76
+ */
77
+ messages: Array<{
78
+ message: string;
79
+ senderId: string;
80
+ senderName: string;
81
+ timestamp: Date;
82
+ topic: string;
83
+ payload: object;
84
+ }>;
73
85
 
74
- /**
75
- * @description These method is used to change the participant mode between CONFERENCE and VIEWER
76
- */
77
- changeMode(mode: 'CONFERENCE' | 'VIEWER'): void;
86
+ /**
87
+ * @description These method is used to join the meeting
88
+ */
89
+ join(): void;
78
90
 
79
- /**
80
- * @description These method is used to leave the meeting for local participant
81
- */
82
- leave(): void;
91
+ /**
92
+ * @description These method is used to change the participant mode between CONFERENCE and VIEWER
93
+ */
94
+ changeMode(mode: 'CONFERENCE' | 'VIEWER'): void;
83
95
 
84
- /**
85
- * @description These method is used to end the meeting for all participants
86
- */
87
- end(): void;
96
+ /**
97
+ * @description These method is used to leave the meeting for local participant
98
+ */
99
+ leave(): void;
88
100
 
89
- /**
90
- * @param participantId `participantId` for which entry is to be responed
91
- * @param decision `true` if the participant is allowed to join the meeting else `false`
92
- */
93
- respondEntry(participantId: string, decision: boolean): void;
94
- /**
95
- * @description returns all the pinned participants in the meeting
96
- */
97
- get pinnedParticipants(): Map<string, Participant>;
101
+ /**
102
+ * @description These method is used to end the meeting for all participants
103
+ */
104
+ end(): void;
98
105
 
99
- /**
100
- * @description Mute the mic of local participant and stop broadcasting audio
101
- */
102
- muteMic(): void;
106
+ /**
107
+ * @param participantId `participantId` for which entry is to be responed
108
+ * @param decision `true` if the participant is allowed to join the meeting else `false`
109
+ */
110
+ respondEntry(participantId: string, decision: boolean): void;
111
+ /**
112
+ * @description returns all the pinned participants in the meeting
113
+ */
114
+ get pinnedParticipants(): Map<string, Participant>;
103
115
 
104
- /**
105
- * @param customAudioTrack You can pass your own custom audio track here.
106
- * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-audio-track)
107
- * @description unmute the mic of local participant and start broadcasting audio
108
- */
109
- unmuteMic(customAudioTrack?: MediaStream): void;
116
+ /**
117
+ * @description Mute the mic of local participant and stop broadcasting audio
118
+ */
119
+ muteMic(): void;
110
120
 
111
- /**
112
- *
113
- * @description This method is used to stop boradcasting the video to other participants
114
- */
115
- disableWebcam(): void;
121
+ /**
122
+ * @param customAudioTrack You can pass your own custom audio track here.
123
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-audio-track)
124
+ * @description unmute the mic of local participant and start broadcasting audio
125
+ */
126
+ unmuteMic(customAudioTrack?: MediaStream): void;
116
127
 
117
- /**
118
- * @param customVideoTrack You can pass your own custom video track here.
119
- * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-video-track)
120
- * @description This method will turn on the webcam of local participant and start broadcasting video
121
- */
122
- enableWebcam(customVideoTrack?: MediaStream): void;
123
- /**
124
- * @description This method is used to stop boradcasting the screenshare to other participants
125
- */
126
- disableScreenShare(): void;
127
- /**
128
- * @param customScreenSharingTrack You can pass your own custom screen share track here.
129
- * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-screen-share-track)
130
- * @description This method will start broadcasting participants screen share
131
- *
132
- */
133
- enableScreenShare(customScreenSharingTrack?: MediaStream): void;
128
+ /**
129
+ *
130
+ * @description This method is used to stop boradcasting the video to other participants
131
+ */
132
+ disableWebcam(): void;
134
133
 
135
- /**
136
- * @deprecated
137
- * @param text Message which is to be send to all participants in th meeting
138
- */
139
- sendChatMessage(text: string): void;
134
+ /**
135
+ * @param customVideoTrack You can pass your own custom video track here.
136
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-video-track)
137
+ * @description This method will turn on the webcam of local participant and start broadcasting video
138
+ */
139
+ enableWebcam(customVideoTrack?: MediaStream): void;
140
+ /**
141
+ * @description This method is used to stop boradcasting the screenshare to other participants
142
+ */
143
+ disableScreenShare(): void;
144
+ /**
145
+ * @param customScreenSharingTrack You can pass your own custom screen share track here.
146
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-screen-share-track)
147
+ * @description This method will start broadcasting participants screen share
148
+ *
149
+ */
150
+ enableScreenShare(customScreenSharingTrack?: MediaStream): void;
140
151
 
141
- /**
142
- * @param webhookUrl
143
- * Webhook URL which will be called by VideoSDK when the recording state gets changed
144
- * @param awsDirPath?
145
- * awsDirPath represents the Directory you want to store your recording if you have configured your own S3 storage
146
- *
147
- * @param config Config can be used to configure the HLS stream
148
- * @param config.layout.type These represents the layout which is to used in the HLS
149
- * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
150
- * @param config.layout.gridSize These defines the maximum number of participants in the grid
151
- * @param config.theme These defines the color theme of the HLS livestream
152
- * @param config.mode These defines the mode of the HLS livestream as only audio or vidoe and audio both
153
- * @param config.quality These defines the quality of the HLS livestream
154
- */
155
- startRecording(
156
- webhookUrl: string,
157
- awsDirPath: string,
158
- config: {
159
- layout: {
160
- type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
161
- priority: 'SPEAKER' | 'PIN';
162
- gridSize: number;
163
- };
164
- theme: 'DARK' | 'LIGHT' | 'DEFAULT';
165
- mode: 'video-and-audio' | 'audio';
166
- quality: 'low' | 'med' | 'high';
167
- },
168
- ): void;
152
+ /**
153
+ * @deprecated
154
+ * @param text Message which is to be send to all participants in th meeting
155
+ */
156
+ sendChatMessage(text: string): void;
169
157
 
170
- /**
171
- * @description This method is used to stop the meeting recording
172
- */
173
- stopRecording(): void;
158
+ /**
159
+ * @param webhookUrl
160
+ * Webhook URL which will be called by VideoSDK when the recording state gets changed
161
+ * @param awsDirPath?
162
+ * awsDirPath represents the Directory you want to store your recording if you have configured your own S3 storage
163
+ *
164
+ * @param config Config can be used to configure the HLS stream
165
+ * @param config.layout.type These represents the layout which is to used in the HLS
166
+ * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
167
+ * @param config.layout.gridSize These defines the maximum number of participants in the grid
168
+ * @param config.theme These defines the color theme of the HLS livestream
169
+ * @param config.mode These defines the mode of the HLS livestream as only audio or vidoe and audio both
170
+ * @param config.quality These defines the quality of the HLS livestream
171
+ */
172
+ startRecording(
173
+ webhookUrl: string,
174
+ awsDirPath: string,
175
+ config: {
176
+ layout: {
177
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
178
+ priority: 'SPEAKER' | 'PIN';
179
+ gridSize: number;
180
+ };
181
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
182
+ mode: 'video-and-audio' | 'audio';
183
+ quality: 'low' | 'med' | 'high';
184
+ }
185
+ ): void;
174
186
 
175
- /**
176
- * These method is used to start the meeting RTMP to provided output
177
- * @param outputs These defines the array of outputs to which the RTMP has to be broadcasted
178
- * @param config Config can be used to configure the HLS stream
179
- * @param config.layout.type These represents the layout which is to used in the HLS
180
- * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
181
- * @param config.layout.gridSize These defines the maximum number of participants in the grid
182
- * @param config.theme These defines the color theme of the RTMP livestream
183
- */
184
- startLivestream(
185
- outputs: Array<{
186
- url: string;
187
- streamKey: string;
188
- }>,
189
- config?: {
190
- layout: {
191
- type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
192
- priority: 'SPEAKER' | 'PIN';
193
- gridSize: number;
194
- };
195
- theme: 'DARK' | 'LIGHT' | 'DEFAULT';
196
- },
197
- ): void;
187
+ /**
188
+ * @description This method is used to stop the meeting recording
189
+ */
190
+ stopRecording(): void;
198
191
 
199
- /**
200
- * @description This method is used to stop the meeting livestream
201
- */
202
- stopLivestream(): void;
192
+ /**
193
+ * These method is used to start the meeting RTMP to provided output
194
+ * @param outputs These defines the array of outputs to which the RTMP has to be broadcasted
195
+ * @param config Config can be used to configure the HLS stream
196
+ * @param config.layout.type These represents the layout which is to used in the HLS
197
+ * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
198
+ * @param config.layout.gridSize These defines the maximum number of participants in the grid
199
+ * @param config.theme These defines the color theme of the RTMP livestream
200
+ */
201
+ startLivestream(
202
+ outputs: Array<{
203
+ url: string;
204
+ streamKey: string;
205
+ }>,
206
+ config?: {
207
+ layout: {
208
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
209
+ priority: 'SPEAKER' | 'PIN';
210
+ gridSize: number;
211
+ };
212
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
213
+ }
214
+ ): void;
203
215
 
204
- /**
205
- * These method is used to start the meeting HLS
206
- * @param config Config can be used to configure the HLS stream
207
- * @param config.layout.type These represents the layout which is to used in the HLS
208
- * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
209
- * @param config.layout.gridSize These defines the maximum number of participants in the grid
210
- * @param config.theme These defines the color theme of the HLS livestream
211
- * @param config.mode These defines the mode of the HLS livestream as only audio or vidoe and audio both
212
- * @param config.quality These defines the quality of the HLS livestream
213
- */
214
- startHls(config?: {
215
- layout: {
216
- type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
217
- priority: 'SPEAKER' | 'PIN';
218
- gridSize: number;
219
- };
220
- theme: 'DARK' | 'LIGHT' | 'DEFAULT';
221
- mode: 'video-and-audio' | 'audio';
222
- quality: 'low' | 'med' | 'high';
223
- }): Promise<void>;
216
+ /**
217
+ * @description This method is used to stop the meeting livestream
218
+ */
219
+ stopLivestream(): void;
224
220
 
225
- /**
226
- * @description This method is used to stop the meeting HLS
227
- */
228
- stopHls(): void;
221
+ /**
222
+ * These method is used to start the meeting HLS
223
+ * @param config Config can be used to configure the HLS stream
224
+ * @param config.layout.type These represents the layout which is to used in the HLS
225
+ * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
226
+ * @param config.layout.gridSize These defines the maximum number of participants in the grid
227
+ * @param config.theme These defines the color theme of the HLS livestream
228
+ * @param config.mode These defines the mode of the HLS livestream as only audio or vidoe and audio both
229
+ * @param config.quality These defines the quality of the HLS livestream
230
+ */
231
+ startHls(config?: {
232
+ layout: {
233
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
234
+ priority: 'SPEAKER' | 'PIN';
235
+ gridSize: number;
236
+ };
237
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
238
+ mode: 'video-and-audio' | 'audio';
239
+ quality: 'low' | 'med' | 'high';
240
+ }): Promise<void>;
229
241
 
230
- /**
231
- * @description This method returns all the available mics
232
- */
233
- getMics(): Promise<
234
- Array<{
235
- deviceId: string;
236
- label: string;
237
- }>
238
- >;
242
+ /**
243
+ * @description This method is used to stop the meeting HLS
244
+ */
245
+ stopHls(): void;
239
246
 
240
- /**
241
- * @description This method returns all the available webcams
242
- */
243
- getWebcams(): Promise<
244
- Array<{
245
- deviceId: string;
246
- label: string;
247
- facingMode: 'front' | 'environment';
248
- }>
249
- >;
247
+ /**
248
+ * @description This method returns all the available mics
249
+ */
250
+ getMics(): Promise<
251
+ Array<{
252
+ deviceId: string;
253
+ label: string;
254
+ }>
255
+ >;
250
256
 
251
- /**
252
- *
253
- * @param object These can be the `deviceId` to which the mic input has to be changed or
254
- * you can pass the audio stream to this method which will be used for the audio broadcast
255
- */
256
- changeMic(object: string | MediaStream): void;
257
+ /**
258
+ * @description This method returns all the available webcams
259
+ */
260
+ getWebcams(): Promise<
261
+ Array<{
262
+ deviceId: string;
263
+ label: string;
264
+ facingMode: 'front' | 'environment';
265
+ }>
266
+ >;
257
267
 
258
- /**
259
- *
260
- * @param object These can be the `deviceId` to which the webcam input has to be changed or
261
- * you can pass the video stream to this method which will be used for the video broadcast
262
- */
263
- changeWebcam(object: string | MediaStream): void;
268
+ /**
269
+ *
270
+ * @param object These can be the `deviceId` to which the mic input has to be changed or
271
+ * you can pass the audio stream to this method which will be used for the audio broadcast
272
+ */
273
+ changeMic(object: string | MediaStream): void;
264
274
 
265
- /**
266
- * @param stream This method will be used to replace the provided stream with current webcam stream
267
- */
268
- replaceWebcamStream(stream: MediaStream): void;
275
+ /**
276
+ *
277
+ * @param object These can be the `deviceId` to which the webcam input has to be changed or
278
+ * you can pass the video stream to this method which will be used for the video broadcast
279
+ */
280
+ changeWebcam(object: string | MediaStream): void;
269
281
 
270
- /**
271
- *
272
- * @param quality This method will be used set the webcam quality to be used.
273
- */
274
- setWebcamQuality(quality: 'low' | 'med' | 'high'): void;
282
+ /**
283
+ * @param stream This method will be used to replace the provided stream with current webcam stream
284
+ */
285
+ replaceWebcamStream(stream: MediaStream): void;
275
286
 
276
- /**
277
- * Used for internal purpose
278
- */
279
- startWhiteboard(): void;
287
+ /**
288
+ *
289
+ * @param quality This method will be used set the webcam quality to be used.
290
+ */
291
+ setWebcamQuality(quality: 'low' | 'med' | 'high'): void;
280
292
 
281
- /**
282
- * Used for internal purpose
283
- */
284
- stopWhiteboard(): void;
293
+ /**
294
+ * Used for internal purpose
295
+ */
296
+ startWhiteboard(): void;
285
297
 
286
- /**
287
- * @deprecated
288
- * @param options
289
- */
290
- startVideo({ link }: { link: string }): void;
291
- /**
292
- * @deprecated
293
- */
294
- stopVideo(): void;
295
- /**
296
- * @deprecated
297
- */
298
- resumeVideo(): void;
299
- refreshConnection(): void;
300
- /**
301
- * @deprecated
302
- * @param options
303
- */
304
- pauseVideo({ currentTime }: { currentTime: number }): void;
305
- /**
306
- * @deprecated
307
- * @param options
308
- */
309
- seekVideo({ currentTime }: { currentTime: number }): void;
310
- pubSub: {
311
- /**
312
- * Publish message to a topic
313
- *
314
- * @param topic Topic to which the message will be published
315
- * @param message This will be the actual message which has to be send
316
- * @param options This will define other options like `persist` which will decide if the message has to be stored or not
317
- */
318
- publish: (
319
- topic: string,
320
- message: string,
321
- options: {
322
- persist: boolean;
323
- },
324
- payload: object,
325
- sendOnly: Array<String>
326
- ) => Promise<void>;
327
- /**
328
- * Subscribe to message on a topic
329
- *
330
- * @param topic Topic to which you want to subscribe
331
- * @param callback Callback function which will be triggered when a new message is received
332
- */
333
- subscribe: (
334
- topic: string,
335
- callback: (message: {
336
- id: string;
337
- message: string;
338
- senderId: string;
339
- senderName: string;
340
- timestamp: string;
341
- topic: string;
342
- payload: object;
343
- }) => void,
344
- ) => Promise<
345
- Array<{
346
- id: string;
347
- message: string;
348
- senderId: string;
349
- senderName: string;
350
- timestamp: string;
351
- topic: string;
352
- payload: object;
353
- }>
354
- >;
355
- /**
356
- * Unsubscribe from messages on a topic
357
- *
358
- * @param topic Topic to which you want to stop getting message for
359
- * @param callback Callback function which was passed which subscribing to the topic
360
- */
361
- unsubscribe: (
362
- topic: string,
363
- callback: (message: {
364
- id: string;
365
- message: string;
366
- senderId: string;
367
- senderName: string;
368
- timestamp: string;
369
- topic: string;
370
- payload: object;
371
- }) => void,
372
- ) => Promise<void>;
373
- };
374
- /**
375
- * @deprecated
376
- * @param options
377
- */
378
- connectTo({ meetingId, payload }: { meetingId: string; payload: string }): Promise<void>;
379
- /**
380
- * Add event listener
381
- * @param eventType Event name to which you want to subscribe.
382
- * @param listener Callback function which will be triggered when the event happens
298
+ /**
299
+ * Used for internal purpose
300
+ */
301
+ stopWhiteboard(): void;
302
+
303
+ /**
304
+ * @deprecated
305
+ * @param options
306
+ */
307
+ startVideo({ link }: { link: string }): void;
308
+ /**
309
+ * @deprecated
310
+ */
311
+ stopVideo(): void;
312
+ /**
313
+ * @deprecated
314
+ */
315
+ resumeVideo(): void;
316
+ refreshConnection(): void;
317
+ /**
318
+ * @deprecated
319
+ * @param options
320
+ */
321
+ pauseVideo({ currentTime }: { currentTime: number }): void;
322
+ /**
323
+ * @deprecated
324
+ * @param options
325
+ */
326
+ seekVideo({ currentTime }: { currentTime: number }): void;
327
+ pubSub: {
328
+ /**
329
+ * Publish message to a topic
330
+ *
331
+ * @param topic Topic to which the message will be published
332
+ * @param message This will be the actual message which has to be send
333
+ * @param options This will define other options like `persist` which will decide if the message has to be stored or not
334
+ */
335
+ publish: (
336
+ topic: string,
337
+ message: string,
338
+ options: {
339
+ persist: boolean;
340
+ },
341
+ payload: object,
342
+ sendOnly: Array<String>
343
+ ) => Promise<void>;
344
+ /**
345
+ * Subscribe to message on a topic
346
+ *
347
+ * @param topic Topic to which you want to subscribe
348
+ * @param callback Callback function which will be triggered when a new message is received
383
349
  */
384
- on(
385
- eventType:
386
- | 'participant-joined'
387
- | 'participant-left'
388
- | 'participant-mode-change'
389
- | 'speaker-changed'
390
- | 'presenter-changed'
391
- | 'main-participant-changed'
392
- | 'entry-requested'
393
- | 'entry-responded'
394
- | 'recording-started'
395
- | 'recording-stopped'
396
- | 'recording-state-changed'
397
- | 'livestream-started'
398
- | 'livestream-stopped'
399
- | 'livestream-state-changed'
400
- | 'hls-started'
401
- | 'hls-stopped'
402
- | 'hls-state-changed'
403
- | 'stream-enabled'
404
- | 'stream-disabled'
405
- | 'whiteboard-started'
406
- | 'whiteboard-stopped'
407
- | 'meeting-joined'
408
- | 'meeting-left'
409
- | 'video-state-changed'
410
- | 'video-seeked'
411
- | 'mic-requested'
412
- | 'webcam-requested'
413
- | 'pin-state-changed'
414
- | 'connection-open'
415
- | 'connection-close'
416
- | 'meeting-state-changed'
417
- | 'switch-meeting'
418
- | 'error'
419
- | 'chat-message',
420
- listener: (data: any) => void,
421
- ): void;
350
+ subscribe: (
351
+ topic: string,
352
+ callback: (message: {
353
+ id: string;
354
+ message: string;
355
+ senderId: string;
356
+ senderName: string;
357
+ timestamp: string;
358
+ topic: string;
359
+ payload: object;
360
+ }) => void
361
+ ) => Promise<
362
+ Array<{
363
+ id: string;
364
+ message: string;
365
+ senderId: string;
366
+ senderName: string;
367
+ timestamp: string;
368
+ topic: string;
369
+ payload: object;
370
+ }>
371
+ >;
422
372
  /**
423
- * Remove event listener
424
- * @param eventType Event name to which you want to unsubscribe.
425
- * @param listener Callback function which was passed while subscribing to the event
373
+ * Unsubscribe from messages on a topic
374
+ *
375
+ * @param topic Topic to which you want to stop getting message for
376
+ * @param callback Callback function which was passed which subscribing to the topic
426
377
  */
427
- off(
428
- eventType:
429
- | 'participant-joined'
430
- | 'participant-left'
431
- | 'participant-mode-change'
432
- | 'speaker-changed'
433
- | 'presenter-changed'
434
- | 'main-participant-changed'
435
- | 'entry-requested'
436
- | 'entry-responded'
437
- | 'recording-started'
438
- | 'recording-stopped'
439
- | 'recording-state-changed'
440
- | 'livestream-started'
441
- | 'livestream-stopped'
442
- | 'livestream-state-changed'
443
- | 'hls-started'
444
- | 'hls-stopped'
445
- | 'hls-state-changed'
446
- | 'stream-enabled'
447
- | 'stream-disabled'
448
- | 'whiteboard-started'
449
- | 'whiteboard-stopped'
450
- | 'meeting-joined'
451
- | 'meeting-left'
452
- | 'video-state-changed'
453
- | 'video-seeked'
454
- | 'mic-requested'
455
- | 'webcam-requested'
456
- | 'pin-state-changed'
457
- | 'connection-open'
458
- | 'connection-close'
459
- | 'meeting-state-changed'
460
- | 'switch-meeting'
461
- | 'error'
462
- | 'chat-message',
463
- listener: (data: any) => void,
464
- ): void;
378
+ unsubscribe: (
379
+ topic: string,
380
+ callback: (message: {
381
+ id: string;
382
+ message: string;
383
+ senderId: string;
384
+ senderName: string;
385
+ timestamp: string;
386
+ topic: string;
387
+ payload: object;
388
+ }) => void
389
+ ) => Promise<void>;
390
+ };
391
+ /**
392
+ * @deprecated
393
+ * @param options
394
+ */
395
+ connectTo({
396
+ meetingId,
397
+ payload
398
+ }: {
399
+ meetingId: string;
400
+ payload: string;
401
+ }): Promise<void>;
402
+ /**
403
+ * Add event listener
404
+ * @param eventType Event name to which you want to subscribe.
405
+ * @param listener Callback function which will be triggered when the event happens
406
+ */
407
+ on(
408
+ eventType:
409
+ | 'participant-joined'
410
+ | 'participant-left'
411
+ | 'participant-mode-change'
412
+ | 'speaker-changed'
413
+ | 'presenter-changed'
414
+ | 'main-participant-changed'
415
+ | 'entry-requested'
416
+ | 'entry-responded'
417
+ | 'recording-started'
418
+ | 'recording-stopped'
419
+ | 'recording-state-changed'
420
+ | 'livestream-started'
421
+ | 'livestream-stopped'
422
+ | 'livestream-state-changed'
423
+ | 'hls-started'
424
+ | 'hls-stopped'
425
+ | 'hls-state-changed'
426
+ | 'stream-enabled'
427
+ | 'stream-disabled'
428
+ | 'whiteboard-started'
429
+ | 'whiteboard-stopped'
430
+ | 'meeting-joined'
431
+ | 'meeting-left'
432
+ | 'video-state-changed'
433
+ | 'video-seeked'
434
+ | 'mic-requested'
435
+ | 'webcam-requested'
436
+ | 'pin-state-changed'
437
+ | 'connection-open'
438
+ | 'connection-close'
439
+ | 'meeting-state-changed'
440
+ | 'switch-meeting'
441
+ | 'error'
442
+ | 'chat-message',
443
+ listener: (data: any) => void
444
+ ): void;
445
+ /**
446
+ * Remove event listener
447
+ * @param eventType Event name to which you want to unsubscribe.
448
+ * @param listener Callback function which was passed while subscribing to the event
449
+ */
450
+ off(
451
+ eventType:
452
+ | 'participant-joined'
453
+ | 'participant-left'
454
+ | 'participant-mode-change'
455
+ | 'speaker-changed'
456
+ | 'presenter-changed'
457
+ | 'main-participant-changed'
458
+ | 'entry-requested'
459
+ | 'entry-responded'
460
+ | 'recording-started'
461
+ | 'recording-stopped'
462
+ | 'recording-state-changed'
463
+ | 'livestream-started'
464
+ | 'livestream-stopped'
465
+ | 'livestream-state-changed'
466
+ | 'hls-started'
467
+ | 'hls-stopped'
468
+ | 'hls-state-changed'
469
+ | 'stream-enabled'
470
+ | 'stream-disabled'
471
+ | 'whiteboard-started'
472
+ | 'whiteboard-stopped'
473
+ | 'meeting-joined'
474
+ | 'meeting-left'
475
+ | 'video-state-changed'
476
+ | 'video-seeked'
477
+ | 'mic-requested'
478
+ | 'webcam-requested'
479
+ | 'pin-state-changed'
480
+ | 'connection-open'
481
+ | 'connection-close'
482
+ | 'meeting-state-changed'
483
+ | 'switch-meeting'
484
+ | 'error'
485
+ | 'chat-message',
486
+ listener: (data: any) => void
487
+ ): void;
465
488
  }
466
489
 
467
490
  import { Participant } from './participant';