@signalwire/js 3.19.0 → 3.19.1
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/dist/core/src/BaseSession.d.ts +4 -0
- package/dist/core/src/BaseSession.d.ts.map +1 -1
- package/dist/core/src/memberPosition/workers.d.ts +1 -1
- package/dist/core/src/redux/actions.d.ts +5 -5
- package/dist/core/src/redux/actions.d.ts.map +1 -1
- package/dist/core/src/redux/rootSaga.d.ts +1 -1
- package/dist/core/src/redux/rootSaga.d.ts.map +1 -1
- package/dist/core/src/utils/interfaces.d.ts +1 -1
- package/dist/core/src/utils/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +113 -96
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +113 -96
- package/dist/index.js.map +2 -2
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/js/src/BaseRoomSession.d.ts.map +1 -1
- package/dist/js/src/RoomSession.d.ts.map +1 -1
- package/dist/js/src/video/childMemberJoinedWorker.d.ts +1 -1
- package/dist/js/src/video/childMemberJoinedWorker.d.ts.map +1 -1
- package/dist/js/tsconfig.build.tsbuildinfo +1 -1
- package/dist/webrtc/src/BaseConnection.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/BaseRoomSession.ts +121 -113
- package/src/RoomSession.ts +4 -0
- package/src/video/childMemberJoinedWorker.ts +21 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseConnection.d.ts","sourceRoot":"","sources":["../../../../webrtc/src/BaseConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAEb,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,EAEL,YAAY,EACZ,sBAAsB,EAMtB,YAAY,EACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,iBAA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jB,gBAAgB;IAChB,oBAAoB;IAMpB,gBAAgB;IAChB,QAAQ,CAAC,KAAK,EAAE,mBAAmB;IAyBnC,gBAAgB;IAChB,kBAAkB,CAAC,OAAO,EAAE;QAC1B,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,cAAc,CAAC,EAAE,OAAO,CAAA;KACzB;IASD,gBAAgB;IACT,UAAU,WAAY,gBAAgB,UAgC5C;IAED;;;;SAIK;IACL,OAAO,CAAC,SAAS;IAIjB;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAWrC,gBAAgB;IAChB,SAAS,CAAC,SAAS;CAMpB"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "SignalWire JS SDK",
|
|
4
4
|
"author": "SignalWire Team <open.source@signalwire.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "3.19.
|
|
6
|
+
"version": "3.19.1",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.esm.js",
|
|
9
9
|
"unpkg": "dist/index.umd.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"prepublishOnly": "npm run build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@signalwire/core": "3.14.
|
|
47
|
-
"@signalwire/webrtc": "3.6.
|
|
46
|
+
"@signalwire/core": "3.14.1",
|
|
47
|
+
"@signalwire/webrtc": "3.6.2",
|
|
48
48
|
"jwt-decode": "^3.1.2"
|
|
49
49
|
},
|
|
50
50
|
"types": "dist/js/src/index.d.ts"
|
package/src/BaseRoomSession.ts
CHANGED
|
@@ -292,76 +292,80 @@ export class RoomSessionConnection
|
|
|
292
292
|
* Allow sharing the screen within the room.
|
|
293
293
|
*/
|
|
294
294
|
async startScreenShare(opts: StartScreenShareOptions = {}) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const options: BaseConnectionOptions<RoomSessionObjectEvents> = {
|
|
307
|
-
...this.options,
|
|
308
|
-
screenShare: true,
|
|
309
|
-
recoverCall: false,
|
|
310
|
-
localStream: displayStream,
|
|
311
|
-
remoteStream: undefined,
|
|
312
|
-
userVariables: {
|
|
313
|
-
...(this.options?.userVariables || {}),
|
|
314
|
-
memberCallId: this.callId,
|
|
315
|
-
memberId: this.memberId,
|
|
316
|
-
},
|
|
317
|
-
layout,
|
|
318
|
-
positions,
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const screenShare = connect<
|
|
322
|
-
RoomSessionScreenShareEvents,
|
|
323
|
-
RoomSessionScreenShareConnection,
|
|
324
|
-
RoomSessionScreenShare
|
|
325
|
-
>({
|
|
326
|
-
store: this.store,
|
|
327
|
-
Component: RoomSessionScreenShareAPI,
|
|
328
|
-
})(options)
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Hangup if the user stop the screenShare from the
|
|
332
|
-
* native browser button or if the videoTrack ends.
|
|
333
|
-
*/
|
|
334
|
-
displayStream.getVideoTracks().forEach((t) => {
|
|
335
|
-
t.addEventListener('ended', () => {
|
|
336
|
-
if (screenShare && screenShare.active) {
|
|
337
|
-
screenShare.leave()
|
|
338
|
-
}
|
|
295
|
+
return new Promise<RoomSessionScreenShare>(async (resolve, reject) => {
|
|
296
|
+
const {
|
|
297
|
+
autoJoin = true,
|
|
298
|
+
audio = false,
|
|
299
|
+
video = true,
|
|
300
|
+
layout,
|
|
301
|
+
positions,
|
|
302
|
+
} = opts
|
|
303
|
+
const displayStream: MediaStream = await getDisplayMedia({
|
|
304
|
+
audio: audio === true ? SCREENSHARE_AUDIO_CONSTRAINTS : audio,
|
|
305
|
+
video,
|
|
339
306
|
})
|
|
340
|
-
|
|
307
|
+
const options: BaseConnectionOptions<RoomSessionObjectEvents> = {
|
|
308
|
+
...this.options,
|
|
309
|
+
screenShare: true,
|
|
310
|
+
recoverCall: false,
|
|
311
|
+
localStream: displayStream,
|
|
312
|
+
remoteStream: undefined,
|
|
313
|
+
userVariables: {
|
|
314
|
+
...(this.options?.userVariables || {}),
|
|
315
|
+
memberCallId: this.callId,
|
|
316
|
+
memberId: this.memberId,
|
|
317
|
+
},
|
|
318
|
+
layout,
|
|
319
|
+
positions,
|
|
320
|
+
}
|
|
341
321
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
322
|
+
const screenShare = connect<
|
|
323
|
+
RoomSessionScreenShareEvents,
|
|
324
|
+
RoomSessionScreenShareConnection,
|
|
325
|
+
RoomSessionScreenShare
|
|
326
|
+
>({
|
|
327
|
+
store: this.store,
|
|
328
|
+
Component: RoomSessionScreenShareAPI,
|
|
329
|
+
})(options)
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Hangup if the user stop the screenShare from the
|
|
333
|
+
* native browser button or if the videoTrack ends.
|
|
334
|
+
*/
|
|
335
|
+
displayStream.getVideoTracks().forEach((t) => {
|
|
336
|
+
t.addEventListener('ended', () => {
|
|
337
|
+
if (screenShare && screenShare.active) {
|
|
338
|
+
screenShare.leave()
|
|
339
|
+
}
|
|
340
|
+
})
|
|
341
|
+
})
|
|
347
342
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
parentId: this.memberId,
|
|
353
|
-
},
|
|
343
|
+
screenShare.once('destroy', () => {
|
|
344
|
+
// @ts-expect-error
|
|
345
|
+
screenShare.emit('room.left')
|
|
346
|
+
this._screenShareList.delete(screenShare)
|
|
354
347
|
})
|
|
355
348
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
349
|
+
try {
|
|
350
|
+
screenShare.runWorker('childMemberJoinedWorker', {
|
|
351
|
+
worker: workers.childMemberJoinedWorker,
|
|
352
|
+
onDone: () => resolve(screenShare),
|
|
353
|
+
onFail: reject,
|
|
354
|
+
initialState: {
|
|
355
|
+
parentId: this.memberId,
|
|
356
|
+
},
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
this._screenShareList.add(screenShare)
|
|
360
|
+
if (autoJoin) {
|
|
361
|
+
return await screenShare.join()
|
|
362
|
+
}
|
|
363
|
+
return resolve(screenShare)
|
|
364
|
+
} catch (error) {
|
|
365
|
+
this.logger.error('ScreenShare Error', error)
|
|
366
|
+
reject(error)
|
|
359
367
|
}
|
|
360
|
-
|
|
361
|
-
} catch (error) {
|
|
362
|
-
this.logger.error('ScreenShare Error', error)
|
|
363
|
-
throw error
|
|
364
|
-
}
|
|
368
|
+
})
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
/**
|
|
@@ -390,60 +394,64 @@ export class RoomSessionConnection
|
|
|
390
394
|
* Allow to add additional devices to the room like cameras or microphones.
|
|
391
395
|
*/
|
|
392
396
|
async addDevice(opts: AddDeviceOptions = {}) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const options: BaseConnectionOptions<RoomSessionObjectEvents> = {
|
|
401
|
-
...this.options,
|
|
402
|
-
localStream: undefined,
|
|
403
|
-
remoteStream: undefined,
|
|
404
|
-
audio,
|
|
405
|
-
video,
|
|
406
|
-
additionalDevice: true,
|
|
407
|
-
recoverCall: false,
|
|
408
|
-
userVariables: {
|
|
409
|
-
...(this.options?.userVariables || {}),
|
|
410
|
-
memberCallId: this.callId,
|
|
411
|
-
memberId: this.memberId,
|
|
412
|
-
},
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
const roomDevice = connect<
|
|
416
|
-
RoomSessionDeviceEvents,
|
|
417
|
-
RoomSessionDeviceConnection,
|
|
418
|
-
RoomSessionDevice
|
|
419
|
-
>({
|
|
420
|
-
store: this.store,
|
|
421
|
-
Component: RoomSessionDeviceAPI,
|
|
422
|
-
})(options)
|
|
423
|
-
|
|
424
|
-
roomDevice.once('destroy', () => {
|
|
425
|
-
// @ts-expect-error
|
|
426
|
-
roomDevice.emit('room.left')
|
|
427
|
-
this._deviceList.delete(roomDevice)
|
|
428
|
-
})
|
|
397
|
+
return new Promise<RoomSessionDevice>(async (resolve, reject) => {
|
|
398
|
+
const { autoJoin = true, audio = false, video = false } = opts
|
|
399
|
+
if (!audio && !video) {
|
|
400
|
+
throw new TypeError(
|
|
401
|
+
'At least one of `audio` or `video` must be requested.'
|
|
402
|
+
)
|
|
403
|
+
}
|
|
429
404
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
405
|
+
const options: BaseConnectionOptions<RoomSessionObjectEvents> = {
|
|
406
|
+
...this.options,
|
|
407
|
+
localStream: undefined,
|
|
408
|
+
remoteStream: undefined,
|
|
409
|
+
audio,
|
|
410
|
+
video,
|
|
411
|
+
additionalDevice: true,
|
|
412
|
+
recoverCall: false,
|
|
413
|
+
userVariables: {
|
|
414
|
+
...(this.options?.userVariables || {}),
|
|
415
|
+
memberCallId: this.callId,
|
|
416
|
+
memberId: this.memberId,
|
|
435
417
|
},
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const roomDevice = connect<
|
|
421
|
+
RoomSessionDeviceEvents,
|
|
422
|
+
RoomSessionDeviceConnection,
|
|
423
|
+
RoomSessionDevice
|
|
424
|
+
>({
|
|
425
|
+
store: this.store,
|
|
426
|
+
Component: RoomSessionDeviceAPI,
|
|
427
|
+
})(options)
|
|
428
|
+
|
|
429
|
+
roomDevice.once('destroy', () => {
|
|
430
|
+
// @ts-expect-error
|
|
431
|
+
roomDevice.emit('room.left')
|
|
432
|
+
this._deviceList.delete(roomDevice)
|
|
436
433
|
})
|
|
437
434
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
435
|
+
try {
|
|
436
|
+
roomDevice.runWorker('childMemberJoinedWorker', {
|
|
437
|
+
worker: workers.childMemberJoinedWorker,
|
|
438
|
+
onDone: () => resolve(roomDevice),
|
|
439
|
+
onFail: reject,
|
|
440
|
+
initialState: {
|
|
441
|
+
parentId: this.memberId,
|
|
442
|
+
},
|
|
443
|
+
})
|
|
444
|
+
|
|
445
|
+
this._deviceList.add(roomDevice)
|
|
446
|
+
if (autoJoin) {
|
|
447
|
+
return await roomDevice.join()
|
|
448
|
+
}
|
|
449
|
+
return resolve(roomDevice)
|
|
450
|
+
} catch (error) {
|
|
451
|
+
this.logger.error('RoomDevice Error', error)
|
|
452
|
+
reject(error)
|
|
441
453
|
}
|
|
442
|
-
|
|
443
|
-
} catch (error) {
|
|
444
|
-
this.logger.error('RoomDevice Error', error)
|
|
445
|
-
throw error
|
|
446
|
-
}
|
|
454
|
+
})
|
|
447
455
|
}
|
|
448
456
|
|
|
449
457
|
join() {
|
package/src/RoomSession.ts
CHANGED
|
@@ -159,6 +159,10 @@ export const RoomSession = function (roomOptions: RoomSessionOptions) {
|
|
|
159
159
|
client.disconnect()
|
|
160
160
|
})
|
|
161
161
|
|
|
162
|
+
client.once('session.disconnected', () => {
|
|
163
|
+
room.destroy()
|
|
164
|
+
})
|
|
165
|
+
|
|
162
166
|
const join = (params?: BaseRoomSessionJoinParams) => {
|
|
163
167
|
return new Promise(async (resolve, reject) => {
|
|
164
168
|
try {
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
VideoMemberJoinedEvent,
|
|
10
10
|
componentSelectors,
|
|
11
11
|
componentActions,
|
|
12
|
+
type ReduxComponent,
|
|
12
13
|
} from '@signalwire/core'
|
|
13
14
|
|
|
14
15
|
import type { BaseConnection } from '@signalwire/webrtc'
|
|
15
16
|
|
|
16
|
-
type ChildMemberJoinedWorkerOnDone = (
|
|
17
|
+
type ChildMemberJoinedWorkerOnDone = () => void
|
|
17
18
|
type ChildMemberJoinedWorkerOnFail = (args: { error: Error }) => void
|
|
18
19
|
|
|
19
20
|
export type ChildMemberJoinedWorkerHooks = SDKWorkerHooks<
|
|
@@ -26,7 +27,7 @@ export const childMemberJoinedWorker: SDKWorker<
|
|
|
26
27
|
ChildMemberJoinedWorkerHooks
|
|
27
28
|
> = function* (options): SagaIterator {
|
|
28
29
|
getLogger().trace('childMemberJoinedWorker started')
|
|
29
|
-
const { channels, instance, initialState } = options
|
|
30
|
+
const { channels, instance, initialState, onDone, onFail } = options
|
|
30
31
|
const { swEventChannel } = channels
|
|
31
32
|
const { parentId } = initialState
|
|
32
33
|
if (!parentId) {
|
|
@@ -49,20 +50,22 @@ export const childMemberJoinedWorker: SDKWorker<
|
|
|
49
50
|
*/
|
|
50
51
|
const { member } = action.payload
|
|
51
52
|
if (member?.parent_id) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* the `memberId` to namespace the object.
|
|
55
|
-
**/
|
|
56
|
-
// @ts-expect-error
|
|
57
|
-
instance._attachListeners(member.id)
|
|
58
|
-
// @ts-expect-error
|
|
59
|
-
instance.applyEmitterTransforms()
|
|
60
|
-
|
|
61
|
-
const parent = yield sagaEffects.select(
|
|
62
|
-
componentSelectors.getComponent,
|
|
63
|
-
member.parent_id
|
|
53
|
+
const byId: Record<string, ReduxComponent> = yield sagaEffects.select(
|
|
54
|
+
componentSelectors.getComponentsById
|
|
64
55
|
)
|
|
56
|
+
const parent = Object.values(byId).find((row) => {
|
|
57
|
+
return 'memberId' in row && row.memberId === member.parent_id
|
|
58
|
+
})
|
|
65
59
|
if (parent) {
|
|
60
|
+
/**
|
|
61
|
+
* For screenShare/additionalDevice we're using the `memberId` to
|
|
62
|
+
* namespace the object.
|
|
63
|
+
**/
|
|
64
|
+
// @ts-expect-error
|
|
65
|
+
instance._attachListeners(member.id)
|
|
66
|
+
// @ts-expect-error
|
|
67
|
+
instance.applyEmitterTransforms()
|
|
68
|
+
|
|
66
69
|
yield sagaEffects.put(
|
|
67
70
|
componentActions.upsert({
|
|
68
71
|
id: instance.callId,
|
|
@@ -71,6 +74,10 @@ export const childMemberJoinedWorker: SDKWorker<
|
|
|
71
74
|
memberId: member.id,
|
|
72
75
|
})
|
|
73
76
|
)
|
|
77
|
+
|
|
78
|
+
onDone?.()
|
|
79
|
+
} else {
|
|
80
|
+
onFail?.({ error: new Error('Unknown parent_id') })
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
83
|
getLogger().trace('childMemberJoinedWorker ended')
|