@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
@@ -7,23 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- var __rest = (this && this.__rest) || function (s, e) {
11
- var t = {};
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
- t[p] = s[p];
14
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
- t[p[i]] = s[p[i]];
18
- }
19
- return t;
20
- };
21
10
  import logger from '../util/logger';
22
11
  import * as WebRTC from '../util/webrtc';
23
- import { roundToFixed } from '../util/helpers';
24
- import { assureDeviceId } from './deviceHelpers';
12
+ import { isDefined } from '../util/helpers';
25
13
  import { DeviceType } from './constants';
26
- export const getUserMedia = (constraints) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const getUserMedia = (constraints) => __awaiter(void 0, void 0, void 0, function* () {
27
15
  logger.info('RTCService.getUserMedia', constraints);
28
16
  const { audio, video } = constraints;
29
17
  if (!audio && !video) {
@@ -37,15 +25,58 @@ export const getUserMedia = (constraints) => __awaiter(void 0, void 0, void 0, f
37
25
  throw error;
38
26
  }
39
27
  });
40
- export const removeUnsupportedConstraints = (constraints) => {
41
- const supported = WebRTC.getSupportedConstraints();
42
- Object.keys(constraints).map(key => {
43
- if (!supported.hasOwnProperty(key) || constraints[key] === null || constraints[key] === undefined) {
44
- delete constraints[key];
28
+ const _constraintsByKind = (kind = null) => {
29
+ return {
30
+ audio: !kind || kind === DeviceType.AudioIn,
31
+ video: !kind || kind === DeviceType.Video
32
+ };
33
+ };
34
+ const getDevices = (kind = null, fullList = false) => __awaiter(void 0, void 0, void 0, function* () {
35
+ let devices = yield WebRTC.enumerateDevices().catch(error => []);
36
+ if (kind) {
37
+ devices = devices.filter((d) => d.kind === kind);
38
+ }
39
+ const valid = devices.length && devices.every((d) => (d.deviceId && d.label));
40
+ if (!valid) {
41
+ const stream = yield WebRTC.getUserMedia(_constraintsByKind(kind));
42
+ WebRTC.stopStream(stream);
43
+ return getDevices(kind);
44
+ }
45
+ if (fullList === true) {
46
+ return devices;
47
+ }
48
+ const found = [];
49
+ devices = devices.filter(({ kind, groupId }) => {
50
+ if (!groupId) {
51
+ return true;
45
52
  }
53
+ const key = `${kind}-${groupId}`;
54
+ if (!found.includes(key)) {
55
+ found.push(key);
56
+ return true;
57
+ }
58
+ return false;
46
59
  });
47
- };
48
- export const getMediaConstraints = (options) => __awaiter(void 0, void 0, void 0, function* () {
60
+ return devices;
61
+ });
62
+ const resolutionList = [[320, 240], [640, 360], [640, 480], [1280, 720], [1920, 1080]];
63
+ const scanResolutions = (deviceId) => __awaiter(void 0, void 0, void 0, function* () {
64
+ const supported = [];
65
+ const stream = yield getUserMedia({ video: { deviceId: { exact: deviceId } } });
66
+ const videoTrack = stream.getVideoTracks()[0];
67
+ for (let i = 0; i < resolutionList.length; i++) {
68
+ const [width, height] = resolutionList[i];
69
+ const success = yield videoTrack.applyConstraints({ width: { exact: width }, height: { exact: height } })
70
+ .then(() => true)
71
+ .catch(() => false);
72
+ if (success) {
73
+ supported.push({ resolution: `${width}x${height}`, width, height });
74
+ }
75
+ }
76
+ WebRTC.stopStream(stream);
77
+ return supported;
78
+ });
79
+ const getMediaConstraints = (options) => __awaiter(void 0, void 0, void 0, function* () {
49
80
  let { audio = true, micId } = options;
50
81
  const { micLabel = '' } = options;
51
82
  if (micId) {
@@ -70,7 +101,85 @@ export const getMediaConstraints = (options) => __awaiter(void 0, void 0, void 0
70
101
  }
71
102
  return { audio, video };
72
103
  });
73
- export const destructSubscribeResponse = (response) => {
104
+ const assureDeviceId = (id, label, kind) => __awaiter(void 0, void 0, void 0, function* () {
105
+ const devices = yield getDevices(kind, true);
106
+ for (let i = 0; i < devices.length; i++) {
107
+ const { deviceId, label: deviceLabel } = devices[i];
108
+ if (id === deviceId || label === deviceLabel) {
109
+ return deviceId;
110
+ }
111
+ }
112
+ return null;
113
+ });
114
+ const removeUnsupportedConstraints = (constraints) => {
115
+ const supported = WebRTC.getSupportedConstraints();
116
+ Object.keys(constraints).map(key => {
117
+ if (!supported.hasOwnProperty(key) || constraints[key] === null || constraints[key] === undefined) {
118
+ delete constraints[key];
119
+ }
120
+ });
121
+ };
122
+ const checkDeviceIdConstraints = (id, label, kind, constraints) => __awaiter(void 0, void 0, void 0, function* () {
123
+ const { deviceId } = constraints;
124
+ if (!isDefined(deviceId) && (id || label)) {
125
+ const deviceId = yield assureDeviceId(id, label, kind).catch(error => null);
126
+ if (deviceId) {
127
+ constraints.deviceId = { exact: deviceId };
128
+ }
129
+ }
130
+ return constraints;
131
+ });
132
+ const sdpStereoHack = (sdp) => {
133
+ const endOfLine = '\r\n';
134
+ const sdpLines = sdp.split(endOfLine);
135
+ const opusIndex = sdpLines.findIndex(s => /^a=rtpmap/.test(s) && /opus\/48000/.test(s));
136
+ if (opusIndex < 0) {
137
+ return sdp;
138
+ }
139
+ const getCodecPayloadType = (line) => {
140
+ const pattern = new RegExp('a=rtpmap:(\\d+) \\w+\\/\\d+');
141
+ const result = line.match(pattern);
142
+ return result && result.length == 2 ? result[1] : null;
143
+ };
144
+ const opusPayload = getCodecPayloadType(sdpLines[opusIndex]);
145
+ const pattern = new RegExp(`a=fmtp:${opusPayload}`);
146
+ const fmtpLineIndex = sdpLines.findIndex(s => pattern.test(s));
147
+ if (fmtpLineIndex >= 0) {
148
+ if (!/stereo=1;/.test(sdpLines[fmtpLineIndex])) {
149
+ sdpLines[fmtpLineIndex] += '; stereo=1; sprop-stereo=1';
150
+ }
151
+ }
152
+ else {
153
+ sdpLines[opusIndex] += `${endOfLine}a=fmtp:${opusPayload} stereo=1; sprop-stereo=1`;
154
+ }
155
+ return sdpLines.join(endOfLine);
156
+ };
157
+ const _isAudioLine = (line) => /^m=audio/.test(line);
158
+ const _isVideoLine = (line) => /^m=video/.test(line);
159
+ const sdpMediaOrderHack = (answer, localOffer) => {
160
+ const endOfLine = '\r\n';
161
+ const offerLines = localOffer.split(endOfLine);
162
+ const offerAudioIndex = offerLines.findIndex(_isAudioLine);
163
+ const offerVideoIndex = offerLines.findIndex(_isVideoLine);
164
+ if (offerAudioIndex < offerVideoIndex) {
165
+ return answer;
166
+ }
167
+ const answerLines = answer.split(endOfLine);
168
+ const answerAudioIndex = answerLines.findIndex(_isAudioLine);
169
+ const answerVideoIndex = answerLines.findIndex(_isVideoLine);
170
+ const audioLines = answerLines.slice(answerAudioIndex, answerVideoIndex);
171
+ const videoLines = answerLines.slice(answerVideoIndex, (answerLines.length - 1));
172
+ const beginLines = answerLines.slice(0, answerAudioIndex);
173
+ return [...beginLines, ...videoLines, ...audioLines, ''].join(endOfLine);
174
+ };
175
+ const checkSubscribeResponse = (response, channel) => {
176
+ if (!response) {
177
+ return false;
178
+ }
179
+ const { subscribed, alreadySubscribed } = destructSubscribeResponse(response);
180
+ return subscribed.includes(channel) || alreadySubscribed.includes(channel);
181
+ };
182
+ const destructSubscribeResponse = (response) => {
74
183
  const tmp = {
75
184
  subscribed: [],
76
185
  alreadySubscribed: [],
@@ -81,15 +190,47 @@ export const destructSubscribeResponse = (response) => {
81
190
  Object.keys(tmp).forEach(k => { tmp[k] = response[`${k}Channels`] || []; });
82
191
  return tmp;
83
192
  };
193
+ const enableAudioTracks = (stream) => {
194
+ _updateMediaStreamTracks(stream, 'audio', true);
195
+ };
196
+ const disableAudioTracks = (stream) => {
197
+ _updateMediaStreamTracks(stream, 'audio', false);
198
+ };
199
+ const toggleAudioTracks = (stream) => {
200
+ _updateMediaStreamTracks(stream, 'audio', null);
201
+ };
202
+ const enableVideoTracks = (stream) => {
203
+ _updateMediaStreamTracks(stream, 'video', true);
204
+ };
205
+ const disableVideoTracks = (stream) => {
206
+ _updateMediaStreamTracks(stream, 'video', false);
207
+ };
208
+ const toggleVideoTracks = (stream) => {
209
+ _updateMediaStreamTracks(stream, 'video', null);
210
+ };
84
211
  const _updateMediaStreamTracks = (stream, kind = null, enabled = null) => {
85
212
  if (!WebRTC.streamIsValid(stream)) {
86
213
  return null;
87
214
  }
88
- const _updateTrack = (track) => {
215
+ let tracks = [];
216
+ switch (kind) {
217
+ case 'audio':
218
+ tracks = stream.getAudioTracks();
219
+ break;
220
+ case 'video':
221
+ tracks = stream.getVideoTracks();
222
+ break;
223
+ default:
224
+ tracks = stream.getTracks();
225
+ break;
226
+ }
227
+ tracks.forEach((track) => {
89
228
  switch (enabled) {
229
+ case 'on':
90
230
  case true:
91
231
  track.enabled = true;
92
232
  break;
233
+ case 'off':
93
234
  case false:
94
235
  track.enabled = false;
95
236
  break;
@@ -97,145 +238,19 @@ const _updateMediaStreamTracks = (stream, kind = null, enabled = null) => {
97
238
  track.enabled = !track.enabled;
98
239
  break;
99
240
  }
100
- };
101
- switch (kind) {
102
- case 'audio':
103
- return stream.getAudioTracks().forEach(_updateTrack);
104
- case 'video':
105
- return stream.getVideoTracks().forEach(_updateTrack);
106
- default:
107
- return stream.getTracks().forEach(_updateTrack);
108
- }
109
- };
110
- export const enableAudioTracks = (stream) => _updateMediaStreamTracks(stream, 'audio', true);
111
- export const disableAudioTracks = (stream) => _updateMediaStreamTracks(stream, 'audio', false);
112
- export const toggleAudioTracks = (stream) => _updateMediaStreamTracks(stream, 'audio', null);
113
- export const enableVideoTracks = (stream) => _updateMediaStreamTracks(stream, 'video', true);
114
- export const disableVideoTracks = (stream) => _updateMediaStreamTracks(stream, 'video', false);
115
- export const toggleVideoTracks = (stream) => _updateMediaStreamTracks(stream, 'video', null);
116
- export const mutateCanvasInfoData = (canvasInfo) => {
117
- const { canvasID, layoutFloorID, scale, canvasLayouts } = canvasInfo, rest = __rest(canvasInfo, ["canvasID", "layoutFloorID", "scale", "canvasLayouts"]);
118
- const layouts = [];
119
- let layoutOverlap = false;
120
- for (let i = 0; i < canvasLayouts.length; i++) {
121
- const layout = canvasLayouts[i];
122
- const { memberID = 0, audioPOS, xPOS, yPOS } = layout, rest = __rest(layout, ["memberID", "audioPOS", "xPOS", "yPOS"]);
123
- layoutOverlap = layoutOverlap || Boolean(layout.overlap === 1 && layout.layerOccupied);
124
- layouts.push(Object.assign({ startX: `${roundToFixed((layout.x / scale) * 100)}%`, startY: `${roundToFixed((layout.y / scale) * 100)}%`, percentageWidth: `${roundToFixed((layout.scale / scale) * 100)}%`, percentageHeight: `${roundToFixed((layout.hscale / scale) * 100)}%`, participantId: String(memberID), audioPos: audioPOS, xPos: xPOS, yPos: yPOS }, rest));
125
- }
126
- return Object.assign(Object.assign({}, rest), { canvasId: canvasID, layoutFloorId: layoutFloorID, scale, canvasLayouts: layouts, layoutOverlap });
127
- };
128
- export const checkIsDirectCall = ({ variables }) => {
129
- return typeof variables === 'object' && 'verto_svar_direct_call' in variables;
130
- };
131
- export const destructConferenceState = (confState) => {
132
- const { variables = {}, flags = {} } = confState;
133
- const suffix = `${confState.md5}@${confState.domain}`;
134
- const confName = confState.displayName || confState.name;
135
- let customCanvas = [];
136
- let customEmpty = [];
137
- let customAlone = [];
138
- try {
139
- customCanvas = JSON.parse(variables.custom_canvas);
140
- customEmpty = JSON.parse(variables.custom_empty);
141
- customAlone = JSON.parse(variables.custom_alone);
142
- }
143
- catch (error) {
144
- logger.warn('Invalid conferenceState vars', error);
145
- }
146
- return {
147
- uuid: confState.uuid,
148
- md5: confState.md5,
149
- domain: confState.domain,
150
- running: Boolean(confState.running),
151
- laName: confState.name,
152
- laChannel: `conference-liveArray.${suffix}`,
153
- infoChannel: `conference-info.${suffix}`,
154
- modChannel: `conference-mod.${suffix}`,
155
- chatChannel: `conference-chat.${suffix}`,
156
- confName,
157
- numMembers: Number(confState.members) || 0,
158
- isPrivate: variables.is_private === 'true',
159
- mohPlaying: Boolean(confState.mohPlaying),
160
- filesPlaying: Boolean(confState.filesPlaying),
161
- filesRole: confState.filesRole || null,
162
- filePlaybackRole: confState.filePlaybackRole || null,
163
- filesPlayingName: confState.filesPlayingName || null,
164
- filesPlayingVolume: Number(confState.filesPlayingVolume) || 0,
165
- filesPlayingPaused: Boolean(confState.filesPlayingPaused),
166
- filesSeekable: Boolean(confState.filesSeekable),
167
- asyncFilesPlaying: Boolean(confState.asyncFilesPlaying),
168
- asyncFilesRole: confState.asyncFilesRole || null,
169
- asyncFilesPlayingName: confState.asyncFilesPlayingName || null,
170
- asyncFilesPlayingVolume: Number(confState.asyncFilesPlayingVolume) || 0,
171
- asyncFilesPlayingPaused: Boolean(confState.asyncFilesPlayingPaused),
172
- asyncFilesSeekable: Boolean(confState.asyncFilesSeekable),
173
- performerDelay: confState.performerDelay,
174
- volAudience: confState['vol-audience'],
175
- filesFullScreen: Boolean(confState.filesFullScreen),
176
- vidFloorRole: confState.vidFloorRole || null,
177
- motionQuality: confState.motionQuality || 1,
178
- motionQualityInbound: confState.motionQualityIn || 1,
179
- videoShuffle: confState.videoShuffle || 0,
180
- zones: confState.zones || [],
181
- maxVisible: confState === null || confState === void 0 ? void 0 : confState.maxVisible,
182
- silentMode: flags['silent-mode'] || false,
183
- blindMode: flags['blind-mode'] || false,
184
- meetingMode: flags['meeting-mode'] || false,
185
- vidMuteHide: flags['vid-mute-hide'] || false,
186
- personalCanvas: Boolean(flags.personalCanvas),
187
- personalCanvasTP: flags.personalCanvasTP || null,
188
- locked: Boolean(flags.locked),
189
- recording: Boolean(flags.recording),
190
- liveMusic: Boolean(flags.liveMusic),
191
- logosVisible: Boolean(flags['logos-visible']),
192
- handraiseOnscreen: Boolean(flags['handraise-onscreen']),
193
- publicClipeeze: variables.public_clipeeze === 'true',
194
- confQuality: variables.conf_quality,
195
- accessPin: variables.access_pin || null,
196
- moderatorPin: variables.moderator_pin || null,
197
- speakerHighlight: variables.speaker_highlight === 'true',
198
- disableIntercom: variables.disable_intercom === true,
199
- lastSnapshot: variables.lastSnapshot,
200
- lastLayoutGroup: variables.lastLayoutGroup,
201
- lastLayout: variables.lastLayout,
202
- userRecordFile: variables.user_record_file || null,
203
- podcastMode: variables.podcast_mode === 'true',
204
- publicDisableChat: variables.public_disable_chat === 'true',
205
- chatOneWay: variables.chat_one_way === 'true',
206
- bannerDisplayOption: variables.banner_display_option,
207
- defaultPlayVolume: Number(variables.default_play_volume) || 0,
208
- hasSms: Boolean(variables.has_sms),
209
- autoOpenNav: Boolean(variables.auto_open_nav),
210
- customCanvas,
211
- customEmpty,
212
- customAlone,
213
- };
214
- };
215
- const _layoutReducer = (result, layout) => {
216
- const { type, name, displayName, resIDS = [] } = layout;
217
- const label = displayName || name.replace(/[-_]/g, ' ');
218
- return result.concat({ id: name, label, type, reservationIds: resIDS, belongsToAGroup: false });
241
+ });
219
242
  };
220
- function _layoutCompare(prev, next) {
221
- const prevLabel = prev.label.toLowerCase();
222
- const nextLabel = next.label.toLowerCase();
223
- if (prevLabel > nextLabel) {
224
- return 1;
225
- }
226
- else if (prevLabel < nextLabel) {
227
- return -1;
228
- }
229
- return 0;
230
- }
231
- export const mungeLayoutList = (layouts, layoutGroups) => {
232
- const layoutsPartOfGroup = layoutGroups.reduce((cumulative, layout) => {
233
- return cumulative.concat(layout.groupLayouts || []);
234
- }, []);
235
- const normalList = layouts.reduce(_layoutReducer, []);
236
- normalList.forEach((layout) => {
237
- layout.belongsToAGroup = layoutsPartOfGroup.includes(layout.id);
243
+ const sdpBitrateHack = (sdp, max, min, start) => {
244
+ const endOfLine = '\r\n';
245
+ const lines = sdp.split(endOfLine);
246
+ lines.forEach((line, i) => {
247
+ if (/^a=fmtp:\d*/.test(line)) {
248
+ lines[i] += `;x-google-max-bitrate=${max};x-google-min-bitrate=${min};x-google-start-bitrate=${start}`;
249
+ }
250
+ else if (/^a=mid:(1|video)/.test(line)) {
251
+ lines[i] += `\r\nb=AS:${max}`;
252
+ }
238
253
  });
239
- const groupList = layoutGroups.reduce(_layoutReducer, []);
240
- return groupList.concat(normalList).sort(_layoutCompare);
254
+ return lines.join(endOfLine);
241
255
  };
256
+ export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, checkSubscribeResponse, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, enableVideoTracks, disableVideoTracks, toggleVideoTracks, };
@@ -20,33 +20,62 @@ export interface CallOptions {
20
20
  camId?: string;
21
21
  camLabel?: string;
22
22
  speakerId?: string;
23
- userVariables?: {
24
- [key: string]: any;
25
- };
23
+ userVariables?: Object;
26
24
  screenShare?: boolean;
27
- secondSource?: boolean;
28
- recoverCall?: boolean;
29
- skipNotifications?: boolean;
30
- skipLiveArray?: boolean;
31
25
  onNotification?: Function;
32
26
  googleMaxBitrate?: number;
33
27
  googleMinBitrate?: number;
34
28
  googleStartBitrate?: number;
35
- negotiateAudio?: boolean;
36
- negotiateVideo?: boolean;
37
- sfu?: boolean;
38
- simulcast?: boolean;
39
- msStreamsNumber?: number;
40
- requestTimeout?: number;
41
- shakenCheck?: string;
42
- shakenResult?: string;
43
- experimental?: boolean;
44
- autoApplyMediaParams?: boolean;
45
- rtcPeerConfig?: {
46
- [key: string]: any;
47
- };
48
- iceGatheringTimeout?: number;
49
- maxIceGatheringTimeout?: number;
29
+ iceTransportPolicy?: RTCConfiguration['iceTransportPolicy'];
30
+ }
31
+ export interface IWebRTCCall {
32
+ id: string;
33
+ state: string;
34
+ prevState: string;
35
+ direction: string;
36
+ options: CallOptions;
37
+ cause: string;
38
+ causeCode: number;
39
+ channels: string[];
40
+ role: string;
41
+ extension: string;
42
+ localStream: MediaStream;
43
+ remoteStream: MediaStream;
44
+ invite: () => void;
45
+ answer: (params?: {
46
+ iceTransportPolicy?: RTCConfiguration['iceTransportPolicy'];
47
+ }) => void;
48
+ hangup: (params: any, execute: boolean) => void;
49
+ transfer: (destination: string) => void;
50
+ replace: (replaceCallID: string) => void;
51
+ hold: () => void;
52
+ unhold: () => void;
53
+ toggleHold: () => void;
54
+ dtmf: (dtmf: string) => void;
55
+ message: (to: string, body: string) => void;
56
+ muteAudio: () => void;
57
+ unmuteAudio: () => void;
58
+ toggleAudioMute: () => void;
59
+ setAudioInDevice: (deviceId: string) => Promise<void>;
60
+ muteVideo: () => void;
61
+ unmuteVideo: () => void;
62
+ toggleVideoMute: () => void;
63
+ setVideoDevice: (deviceId: string) => Promise<void>;
64
+ deaf: () => void;
65
+ undeaf: () => void;
66
+ toggleDeaf: () => void;
67
+ setState: (state: any) => void;
68
+ handleMessage: (msg: any) => void;
69
+ _addChannel: (laChannel: any) => void;
70
+ handleConferenceUpdate: (packet: any, pvtData: any) => Promise<string>;
71
+ startScreenShare?: (opts?: object) => Promise<IWebRTCCall>;
72
+ stopScreenShare?: () => void;
73
+ setAudioOutDevice?: (deviceId: string) => Promise<boolean>;
74
+ switchCamera?: () => void;
75
+ setSpeakerPhone?: (flag: boolean) => void;
76
+ }
77
+ export interface ICantinaAuthParams {
78
+ hostname?: string;
50
79
  }
51
80
  export interface ICantinaUser {
52
81
  first_name: string;
@@ -59,190 +88,3 @@ export interface ICantinaUser {
59
88
  scopes: string[];
60
89
  config?: object;
61
90
  }
62
- export interface VertoPvtData {
63
- callID: string;
64
- nodeId?: string;
65
- action: string;
66
- laChannel: string;
67
- laName: string;
68
- role: string;
69
- chatID: string;
70
- conferenceMemberID: number;
71
- canvasCount: string;
72
- modChannel: string;
73
- chatChannel: string;
74
- infoChannel: string;
75
- conferenceName: string;
76
- conferenceDisplayName: string;
77
- conferenceMD5: string;
78
- conferenceUUID: string;
79
- }
80
- export interface IVertoCanvasInfo {
81
- canvasID: number;
82
- totalLayers: number;
83
- layersUsed: number;
84
- layoutFloorID: number;
85
- layoutName: string;
86
- canvasLayouts: IVertoCanvasLayout[];
87
- scale: number;
88
- }
89
- export interface IVertoCanvasLayout {
90
- x: number;
91
- y: number;
92
- scale: number;
93
- hscale: number;
94
- zoom: number;
95
- border: number;
96
- floor: number;
97
- overlap: number;
98
- screenWidth: number;
99
- screenHeight: number;
100
- xPOS: number;
101
- yPOS: number;
102
- audioPOS: string;
103
- memberID: number;
104
- layerOccupied: boolean;
105
- }
106
- export interface ICanvasInfo {
107
- canvasId: number;
108
- totalLayers: number;
109
- layersUsed: number;
110
- layoutFloorId: number;
111
- layoutName: string;
112
- canvasLayouts: ICanvasLayout[];
113
- scale: number;
114
- layoutOverlap: boolean;
115
- }
116
- export interface ICanvasLayout {
117
- x: number;
118
- y: number;
119
- startX: string;
120
- startY: string;
121
- percentageWidth: string;
122
- percentageHeight: string;
123
- scale: number;
124
- hscale: number;
125
- zoom: number;
126
- border: number;
127
- floor: number;
128
- overlap: number;
129
- screenWidth: number;
130
- screenHeight: number;
131
- xPos: number;
132
- yPos: number;
133
- audioPos: string;
134
- participantId: string;
135
- }
136
- export interface IHangupParams {
137
- code?: string;
138
- cause?: string;
139
- redirectDestination?: any;
140
- }
141
- export interface ICallParticipant {
142
- id: string;
143
- role: string;
144
- layer: ICanvasLayout;
145
- layerIndex: number;
146
- isLayerBehind: boolean;
147
- }
148
- export interface IConferenceInfoMember {
149
- participantId: string;
150
- callId: string;
151
- participantNumber: string;
152
- participantName: string;
153
- }
154
- interface IConferenceZone {
155
- id: string;
156
- name: string;
157
- extVol: number;
158
- }
159
- export interface IConferenceInfo {
160
- uuid: string;
161
- md5: string;
162
- domain: string;
163
- running: boolean;
164
- laName: string;
165
- laChannel: string;
166
- infoChannel: string;
167
- chatChannel: string;
168
- modChannel: string;
169
- confName: string;
170
- numMembers: number;
171
- isPrivate: boolean;
172
- mohPlaying: boolean;
173
- filePlaybackRole: string;
174
- filesPlaying: boolean;
175
- filesRole: string;
176
- filesPlayingName: string;
177
- filesPlayingVolume: number;
178
- filesPlayingPaused: boolean;
179
- filesSeekable: boolean;
180
- asyncFilesPlaying: boolean;
181
- asyncFilesRole: string;
182
- asyncFilesPlayingName: string;
183
- asyncFilesPlayingVolume: number;
184
- asyncFilesPlayingPaused: boolean;
185
- asyncFilesSeekable: boolean;
186
- performerDelay: number;
187
- volAudience: number;
188
- filesFullScreen: boolean;
189
- vidFloorRole: string;
190
- motionQuality: number;
191
- motionQualityInbound: number;
192
- videoShuffle: number | string;
193
- zones: IConferenceZone[];
194
- maxVisible: number;
195
- silentMode: boolean;
196
- blindMode: boolean;
197
- meetingMode: boolean;
198
- locked: boolean;
199
- recording: boolean;
200
- personalCanvas: boolean;
201
- personalCanvasTP: number;
202
- liveMusic: boolean;
203
- vidMuteHide: boolean;
204
- logosVisible: boolean;
205
- handraiseOnscreen: boolean;
206
- publicClipeeze: boolean;
207
- confQuality: string;
208
- accessPin: string;
209
- moderatorPin: string;
210
- speakerHighlight: boolean;
211
- disableIntercom: boolean;
212
- lastSnapshot: string;
213
- lastLayoutGroup: string;
214
- lastLayout: string;
215
- members?: IConferenceInfoMember[];
216
- layouts?: any;
217
- userRecordFile: string;
218
- podcastMode: boolean;
219
- publicDisableChat: boolean;
220
- chatOneWay: boolean;
221
- bannerDisplayOption: string;
222
- defaultPlayVolume: number;
223
- hasSms: boolean;
224
- autoOpenNav: boolean;
225
- customCanvas: string[];
226
- customEmpty: string[];
227
- customAlone: string[];
228
- }
229
- export interface ILayout {
230
- id: string;
231
- label: string;
232
- type: string;
233
- reservationIds: string[];
234
- belongsToAGroup: boolean;
235
- }
236
- export interface IVertoLayout {
237
- name: string;
238
- displayName?: string;
239
- type: string;
240
- resIDS: string[];
241
- groupLayouts?: string[];
242
- }
243
- export interface IVertoConferenceListParams {
244
- showLayouts?: boolean;
245
- showMembers?: boolean;
246
- activeSession?: string;
247
- }
248
- export {};
@@ -1,8 +1,6 @@
1
1
  import Relay from './src/SignalWire';
2
2
  import Verto from './src/Verto';
3
3
  import CantinaAuth from '../common/src/webrtc/CantinaAuth';
4
- export declare const VERSION = "1.3.0-dev.0";
4
+ export declare const VERSION = "1.3.0";
5
5
  export { Relay, Verto, CantinaAuth };
6
- export * from '../common/src/webrtc/deviceHelpers';
7
6
  export * from '../common/src/util/interfaces';
8
- export * from '../common/src/webrtc/interfaces';
@@ -2,7 +2,6 @@ import Relay from './src/SignalWire';
2
2
  import Verto from './src/Verto';
3
3
  import { setAgentName } from '../common/src/messages/blade/Connect';
4
4
  import CantinaAuth from '../common/src/webrtc/CantinaAuth';
5
- export const VERSION = '1.3.0-dev.0';
5
+ export const VERSION = '1.3.0';
6
6
  setAgentName(`JavaScript SDK/${VERSION}`);
7
7
  export { Relay, Verto, CantinaAuth };
8
- export * from '../common/src/webrtc/deviceHelpers';
@@ -1,6 +1,8 @@
1
1
  import BrowserSession from '../../common/src/BrowserSession';
2
+ import BaseMessage from '../../common/src/messages/BaseMessage';
2
3
  import { CallOptions } from '../../common/src/webrtc/interfaces';
3
4
  import Call from '../../common/src/webrtc/Call';
4
5
  export default class SignalWire extends BrowserSession {
6
+ execute(message: BaseMessage): any;
5
7
  newCall(options: CallOptions): Promise<Call>;
6
8
  }