@signalwire/js 1.3.0-dev.0 → 1.3.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.
Files changed (65) hide show
  1. package/README.md +4 -2
  2. package/dist/esm/common/src/BaseSession.d.ts +8 -13
  3. package/dist/esm/common/src/BaseSession.js +33 -46
  4. package/dist/esm/common/src/BrowserSession.d.ts +20 -57
  5. package/dist/esm/common/src/BrowserSession.js +91 -359
  6. package/dist/esm/common/src/messages/Verto.d.ts +1 -10
  7. package/dist/esm/common/src/messages/Verto.js +1 -16
  8. package/dist/esm/common/src/messages/verto/Login.d.ts +1 -13
  9. package/dist/esm/common/src/messages/verto/Login.js +2 -5
  10. package/dist/esm/common/src/services/BroadcastHandler.js +3 -2
  11. package/dist/esm/common/src/services/Handler.d.ts +8 -9
  12. package/dist/esm/common/src/services/Handler.js +38 -41
  13. package/dist/esm/common/src/util/constants/index.d.ts +0 -1
  14. package/dist/esm/common/src/util/constants/index.js +0 -1
  15. package/dist/esm/common/src/util/helpers.d.ts +9 -2
  16. package/dist/esm/common/src/util/helpers.js +11 -6
  17. package/dist/esm/common/src/util/interfaces.d.ts +55 -20
  18. package/dist/esm/common/src/util/logger.js +1 -4
  19. package/dist/esm/common/src/util/webrtc/index.d.ts +1 -6
  20. package/dist/esm/common/src/util/webrtc/index.js +2 -63
  21. package/dist/esm/common/src/webrtc/BaseCall.d.ts +76 -0
  22. package/dist/esm/common/src/webrtc/BaseCall.js +701 -0
  23. package/dist/esm/common/src/webrtc/Call.d.ts +5 -5
  24. package/dist/esm/common/src/webrtc/Call.js +15 -34
  25. package/dist/esm/common/src/webrtc/CantinaAuth.d.ts +13 -8
  26. package/dist/esm/common/src/webrtc/CantinaAuth.js +18 -24
  27. package/dist/esm/common/src/webrtc/LayoutHandler.d.ts +3 -0
  28. package/dist/esm/common/src/webrtc/LayoutHandler.js +36 -0
  29. package/dist/esm/common/src/webrtc/Peer.d.ts +21 -0
  30. package/dist/esm/common/src/webrtc/Peer.js +145 -0
  31. package/dist/esm/common/src/webrtc/VertoHandler.d.ts +11 -2
  32. package/dist/esm/common/src/webrtc/VertoHandler.js +187 -147
  33. package/dist/esm/common/src/webrtc/constants.d.ts +12 -28
  34. package/dist/esm/common/src/webrtc/constants.js +11 -34
  35. package/dist/esm/common/src/webrtc/helpers.d.ts +20 -18
  36. package/dist/esm/common/src/webrtc/helpers.js +177 -162
  37. package/dist/esm/common/src/webrtc/interfaces.d.ts +51 -209
  38. package/dist/esm/js/index.d.ts +1 -3
  39. package/dist/esm/js/index.js +1 -2
  40. package/dist/esm/js/src/SignalWire.d.ts +2 -0
  41. package/dist/esm/js/src/SignalWire.js +13 -0
  42. package/dist/esm/js/src/Verto.d.ts +2 -8
  43. package/dist/esm/js/src/Verto.js +14 -50
  44. package/dist/index.min.js +2 -2
  45. package/package.json +13 -14
  46. package/dist/esm/common/src/webrtc/ChatChannelHandler.d.ts +0 -5
  47. package/dist/esm/common/src/webrtc/ChatChannelHandler.js +0 -22
  48. package/dist/esm/common/src/webrtc/Conference.d.ts +0 -15
  49. package/dist/esm/common/src/webrtc/Conference.js +0 -68
  50. package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.d.ts +0 -5
  51. package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.js +0 -77
  52. package/dist/esm/common/src/webrtc/InfoChannelHandler.d.ts +0 -7
  53. package/dist/esm/common/src/webrtc/InfoChannelHandler.js +0 -85
  54. package/dist/esm/common/src/webrtc/LaChannelHandler.d.ts +0 -5
  55. package/dist/esm/common/src/webrtc/LaChannelHandler.js +0 -58
  56. package/dist/esm/common/src/webrtc/ModChannelHandler.d.ts +0 -71
  57. package/dist/esm/common/src/webrtc/ModChannelHandler.js +0 -267
  58. package/dist/esm/common/src/webrtc/RTCPeer.d.ts +0 -51
  59. package/dist/esm/common/src/webrtc/RTCPeer.js +0 -556
  60. package/dist/esm/common/src/webrtc/WebRTCCall.d.ts +0 -182
  61. package/dist/esm/common/src/webrtc/WebRTCCall.js +0 -784
  62. package/dist/esm/common/src/webrtc/deviceHelpers.d.ts +0 -18
  63. package/dist/esm/common/src/webrtc/deviceHelpers.js +0 -113
  64. package/dist/esm/common/src/webrtc/sdpHelpers.d.ts +0 -3
  65. package/dist/esm/common/src/webrtc/sdpHelpers.js +0 -56
@@ -1,267 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { ConferenceAction } from './constants';
13
- import { mungeLayoutList, destructConferenceState } from './helpers';
14
- export default function modChannelHandler(session, { data, eventChannel, eventSerno = null }) {
15
- const callIds = session.channelToCallIds.get(eventChannel) || [];
16
- let params = null;
17
- switch (data['conf-command']) {
18
- case 'list-videoLayouts': {
19
- if (data.responseData) {
20
- const normal = data.responseData.filter(({ type }) => type === 'layout');
21
- const group = data.responseData.filter(({ type }) => type === 'layoutGroup');
22
- const layouts = mungeLayoutList(normal, group);
23
- params = { action: ConferenceAction.LayoutList, eventChannel, eventSerno, layouts };
24
- }
25
- break;
26
- }
27
- case 'getConferenceState': {
28
- if (data.responseData) {
29
- _dispatch(session, { action: ConferenceAction.ConferenceInfo, eventChannel, eventSerno, conferenceState: destructConferenceState(data.responseData), messages: [] }, callIds);
30
- }
31
- break;
32
- }
33
- default:
34
- params = Object.assign(Object.assign({}, data), { action: ConferenceAction.ModCmdResponse, eventChannel, eventSerno, command: data['conf-command'] });
35
- }
36
- if (params) {
37
- _dispatch(session, params, callIds);
38
- }
39
- }
40
- const _dispatch = (session, params, callIds) => {
41
- if (callIds.length) {
42
- callIds.forEach(callId => {
43
- session.calls[callId] && session.calls[callId]._dispatchConferenceUpdate(params);
44
- });
45
- }
46
- else {
47
- session.dispatchConferenceUpdate(params);
48
- }
49
- };
50
- function _modCommand(params) {
51
- const _a = this, { session, nodeId, channel } = _a, rest = __rest(_a, ["session", "nodeId", "channel"]);
52
- if (!channel) {
53
- return console.warn('Missing modChannel');
54
- }
55
- const data = Object.assign(Object.assign({ application: 'conf-control' }, rest), params);
56
- session.vertoBroadcast({ nodeId, channel, data });
57
- }
58
- export const publicModMethods = {
59
- modCommand: function (command, id, value) {
60
- return _modCommand.call(this, { command, id, value });
61
- },
62
- listVideoLayouts: function () {
63
- const params = { command: 'list-videoLayouts' };
64
- return _modCommand.call(this, params);
65
- },
66
- getConferenceState: function () {
67
- const params = { command: 'getConferenceState' };
68
- return _modCommand.call(this, params);
69
- },
70
- playMedia: function (file) {
71
- return _modCommand.call(this, { command: 'play', value: file });
72
- },
73
- stopMedia: function () {
74
- return _modCommand.call(this, { command: 'stop', value: 'all' });
75
- },
76
- pauseMedia: function (isAsync = true) {
77
- const async = isAsync ? 'async' : '';
78
- return _modCommand.call(this, { command: 'pause_play', value: [async] });
79
- },
80
- fileSeek: function (value, isAsync = true) {
81
- const async = isAsync ? 'async' : '';
82
- return _modCommand.call(this, { command: 'file_seek', value: [String(value), async] });
83
- },
84
- fileVolume: function (value, isAsync = true) {
85
- const async = isAsync ? 'async' : '';
86
- return _modCommand.call(this, { command: 'file-vol', value: [String(value), async] });
87
- },
88
- fileReservationId: function (value, isAsync = true) {
89
- const async = isAsync ? 'async' : '';
90
- return _modCommand.call(this, { command: 'file-res-id', value: [String(value), async] });
91
- },
92
- startRecord: function (file) {
93
- return _modCommand.call(this, { command: 'recording', value: ['start', file] });
94
- },
95
- stopRecord: function () {
96
- return _modCommand.call(this, { command: 'recording', value: ['stop', 'all'] });
97
- },
98
- snapshot: function (file) {
99
- return _modCommand.call(this, { command: 'vid-write-png', value: file });
100
- },
101
- lock: function () {
102
- return _modCommand.call(this, { command: 'lock' });
103
- },
104
- unlock: function () {
105
- return _modCommand.call(this, { command: 'unlock' });
106
- },
107
- setVideoLayout: function (layout, canvasID) {
108
- const value = canvasID ? [layout, canvasID] : layout;
109
- return _modCommand.call(this, { command: 'vid-layout', value });
110
- },
111
- kick: function (id) {
112
- return _modCommand.call(this, { command: 'kick', id });
113
- },
114
- muteAudioAll: function (flags = 'nores:nofloor') {
115
- return _modCommand.call(this, { command: 'mute', value: ['all', flags] });
116
- },
117
- unmuteAudioAll: function () {
118
- return _modCommand.call(this, { command: 'unmute', value: 'all' });
119
- },
120
- muteVideoAll: function () {
121
- return _modCommand.call(this, { command: 'vmute', value: 'all' });
122
- },
123
- unmuteVideoAll: function () {
124
- return _modCommand.call(this, { command: 'unvmute', value: 'all' });
125
- },
126
- muteAudio: function (participantId) {
127
- return _modCommand.call(this, { command: 'mute', id: participantId });
128
- },
129
- unmuteAudio: function (participantId) {
130
- return _modCommand.call(this, { command: 'unmute', id: participantId });
131
- },
132
- toggleAudioMute: function (participantId) {
133
- return _modCommand.call(this, { command: 'tmute', id: participantId });
134
- },
135
- muteVideo: function (participantId) {
136
- return _modCommand.call(this, { command: 'vmute', id: participantId });
137
- },
138
- unmuteVideo: function (participantId) {
139
- return _modCommand.call(this, { command: 'unvmute', id: participantId });
140
- },
141
- toggleVideoMute: function (participantId) {
142
- return _modCommand.call(this, { command: 'tvmute', id: participantId });
143
- },
144
- deaf: function (participantId) {
145
- return _modCommand.call(this, { command: 'deaf', id: participantId });
146
- },
147
- undeaf: function (participantId) {
148
- return _modCommand.call(this, { command: 'undeaf', id: participantId });
149
- },
150
- setReservationId: function (participantId, value = 'presenter') {
151
- return _modCommand.call(this, { command: 'vid-res-id', id: participantId, value });
152
- },
153
- videoFloor: function (participantId) {
154
- return _modCommand.call(this, { command: 'vid-floor', id: participantId, value: 'force' });
155
- },
156
- banner: function (participantId, text) {
157
- return _modCommand.call(this, { command: 'vid-banner', id: participantId, value: encodeURI(text) });
158
- },
159
- volumeDown: function (participantId) {
160
- return _modCommand.call(this, { command: 'volume_out', id: participantId, value: 'down' });
161
- },
162
- volumeUp: function (participantId) {
163
- return _modCommand.call(this, { command: 'volume_out', id: participantId, value: 'up' });
164
- },
165
- gainDown: function (participantId) {
166
- return _modCommand.call(this, { command: 'volume_in', id: participantId, value: 'down' });
167
- },
168
- gainUp: function (participantId) {
169
- return _modCommand.call(this, { command: 'volume_in', id: participantId, value: 'up' });
170
- },
171
- setEnergy: function (participantId, value) {
172
- return _modCommand.call(this, { command: 'energy', id: participantId, value });
173
- },
174
- transferMember: function (participantId, destination) {
175
- return _modCommand.call(this, { command: 'transfer', id: participantId, value: destination });
176
- },
177
- setDenoise: function (participantId, value = null) {
178
- return _modCommand.call(this, { command: 'denoise', id: participantId, value });
179
- },
180
- setLowBitrate: function (participantId, value = null) {
181
- return _modCommand.call(this, { command: 'lowbr', id: participantId, value });
182
- },
183
- addToCall: function (extension, email = '', name = '') {
184
- return _modCommand.call(this, { command: 'xdial', value: [extension, email, name] });
185
- },
186
- setHandRaised: function (participantId, value = null) {
187
- return _modCommand.call(this, { command: 'handraise', id: participantId, value });
188
- },
189
- setVidFloorResId: function (value) {
190
- return _modCommand.call(this, { command: 'vid-floor-res-id', value });
191
- },
192
- confQuality: function (value) {
193
- return _modCommand.call(this, { command: 'quality.lua', value });
194
- },
195
- confMotionQuality: function (value) {
196
- return _modCommand.call(this, { command: 'motion-quality', value });
197
- },
198
- confMotionQualityInbound: function (value) {
199
- return _modCommand.call(this, { command: 'motion-quality-in', value });
200
- },
201
- confMotionQualityMember: function (participantId, value) {
202
- return _modCommand.call(this, { command: 'motion-quality-member', id: participantId, value });
203
- },
204
- confFullscreen: function (participantId, value) {
205
- return _modCommand.call(this, { command: 'full-screen', id: participantId, value });
206
- },
207
- sayAll: function (value) {
208
- return _modCommand.call(this, { command: 'say', value });
209
- },
210
- sayMember: function (participantId, value) {
211
- return _modCommand.call(this, { command: 'saymember', id: participantId, value });
212
- },
213
- setBanner: function (participantId, value) {
214
- return _modCommand.call(this, { command: 'banner.lua', id: participantId, value });
215
- },
216
- setPerformerDelay: function (value) {
217
- return _modCommand.call(this, { command: 'performer-delay', value });
218
- },
219
- setVolumeAudience: function (value) {
220
- return _modCommand.call(this, { command: 'vol-audience', value });
221
- },
222
- toggleVidMuteHide: function (value = 'toggle') {
223
- return _modCommand.call(this, { command: 'vid-mute-hide', value });
224
- },
225
- setMeetingMode: function (value = 'toggle') {
226
- return _modCommand.call(this, { command: 'meeting-mode', value });
227
- },
228
- setSilentMode: function (value = 'toggle') {
229
- return _modCommand.call(this, { command: 'silent-mode', value });
230
- },
231
- setBlindMode: function (value = 'toggle') {
232
- return _modCommand.call(this, { command: 'blind-mode', value });
233
- },
234
- setConfVariable: function (variable, value) {
235
- return _modCommand.call(this, { command: 'setvar', value: [variable, String(value)] });
236
- },
237
- grantModerator: function (participantId, value) {
238
- return _modCommand.call(this, { command: 'grant-moderator', id: participantId, value });
239
- },
240
- grantScreenShare: function (participantId, value) {
241
- return _modCommand.call(this, { command: 'grant-share', id: participantId, value });
242
- },
243
- setPin: function (pin) {
244
- return _modCommand.call(this, { command: 'pin', value: pin });
245
- },
246
- removePin: function () {
247
- return _modCommand.call(this, { command: 'nopin' });
248
- },
249
- setModeratorPin: function (pin) {
250
- return _modCommand.call(this, { command: 'pin', value: `mod ${pin}` });
251
- },
252
- removeModeratorPin: function () {
253
- return _modCommand.call(this, { command: 'pin', value: 'nomod' });
254
- },
255
- setConfLayoutMode: function (value) {
256
- return _modCommand.call(this, { command: 'vid-personal', value });
257
- },
258
- shuffleVideo: function (value) {
259
- return _modCommand.call(this, { command: 'vid-shuffle', value });
260
- },
261
- setVidLogos: function (value) {
262
- return _modCommand.call(this, { command: 'vid-logos', value });
263
- },
264
- setHandraiseOnscreen: function (value) {
265
- return _modCommand.call(this, { command: 'handraise-onscreen', value });
266
- },
267
- };
@@ -1,51 +0,0 @@
1
- import { PeerType } from './constants';
2
- import WebRTCCall from './WebRTCCall';
3
- import { CallOptions } from './interfaces';
4
- export default class RTCPeer {
5
- call: WebRTCCall;
6
- type: PeerType;
7
- private options;
8
- instance: RTCPeerConnection;
9
- private _iceTimeout;
10
- private _negotiating;
11
- constructor(call: WebRTCCall, type: PeerType, options: CallOptions);
12
- get isOffer(): boolean;
13
- get isAnswer(): boolean;
14
- get isSimulcast(): boolean;
15
- get isSfu(): boolean;
16
- get hasExperimentalFlag(): boolean;
17
- get hasAudioSender(): boolean;
18
- get hasVideoSender(): boolean;
19
- get hasAudioReceiver(): boolean;
20
- get hasVideoReceiver(): boolean;
21
- get config(): RTCConfiguration;
22
- get localSdp(): string;
23
- get hasIceServers(): boolean;
24
- stopTrackSender(kind: string): void;
25
- restoreTrackSender(kind: string): Promise<void>;
26
- getDeviceId(kind: string): string;
27
- getTrackSettings(kind: string): MediaTrackSettings;
28
- getDeviceLabel(kind: string): string;
29
- restartIceWithRelayOnly(): void;
30
- applyMediaConstraints(kind: string, constraints: MediaTrackConstraints): Promise<void>;
31
- private _getSenderByKind;
32
- private _getReceiverByKind;
33
- startNegotiation(force?: boolean): Promise<void>;
34
- onRemoteSdp(sdp: string): Promise<void>;
35
- private _logTransceivers;
36
- private _init;
37
- private _checkMediaToNegotiate;
38
- private _sdpIsValid;
39
- private _forceNegotiation;
40
- private _sdpReady;
41
- executeInvite(): Promise<void>;
42
- executeUpdateMedia(): Promise<void>;
43
- executeAnswer(): Promise<void>;
44
- private _execute;
45
- private _onIceTimeout;
46
- private _onIce;
47
- private _setLocalDescription;
48
- private _setRemoteDescription;
49
- private _retrieveLocalStream;
50
- private _buildMediaElementByTrack;
51
- }