@webex/plugin-meetings 3.8.0-next.57 → 3.8.0-next.58

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.
@@ -12,443 +12,430 @@ var _constants = require("../constants");
12
12
  var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
13
13
  /* eslint-disable default-param-last */
14
14
 
15
- var SelfUtils = {};
16
15
  var PSTN_DEVICE_TYPE = 'PROVISIONAL';
17
-
18
- /**
19
- * parses the relevant values for self: muted, guest, moderator, mediaStatus, state, joinedWith, pstnDevices, creator, id
20
- * @param {Object} self
21
- * @param {String} deviceId
22
- * @returns {undefined}
23
- */
24
- SelfUtils.parse = function (self, deviceId) {
25
- if (self) {
26
- var _joinedWith$intent;
27
- var joinedWith = self.devices.find(function (device) {
28
- return deviceId === device.url;
29
- });
30
- var pstnDevices = self.devices.filter(function (device) {
31
- return PSTN_DEVICE_TYPE === device.deviceType;
32
- });
16
+ var SelfUtils = {
17
+ /**
18
+ * parses the relevant values for self: muted, guest, moderator, mediaStatus, state, joinedWith, pstnDevices, creator, id
19
+ * @param {Object} self
20
+ * @param {String} deviceId
21
+ * @returns {undefined}
22
+ */
23
+ parse: function parse(self, deviceId) {
24
+ if (self) {
25
+ var _joinedWith$intent;
26
+ var joinedWith = self.devices.find(function (device) {
27
+ return deviceId === device.url;
28
+ });
29
+ var pstnDevices = self.devices.filter(function (device) {
30
+ return PSTN_DEVICE_TYPE === device.deviceType;
31
+ });
32
+ return {
33
+ remoteVideoMuted: SelfUtils.getRemoteVideoMuted(self),
34
+ remoteMuted: SelfUtils.getRemoteMuted(self),
35
+ unmuteAllowed: SelfUtils.getUnmuteAllowed(self),
36
+ localAudioUnmuteRequested: SelfUtils.getLocalAudioUnmuteRequested(self),
37
+ localAudioUnmuteRequestedTimeStamp: SelfUtils.getLocalAudioUnmuteRequestedTimeStamp(self),
38
+ localAudioUnmuteRequired: SelfUtils.getLocalAudioUnmuteRequired(self),
39
+ lastModified: SelfUtils.getLastModified(self),
40
+ modifiedBy: SelfUtils.getModifiedBy(self),
41
+ guest: self.guest,
42
+ moderator: self.moderator,
43
+ // cumulative media stats
44
+ mediaStatus: SelfUtils.getStatus(self.status),
45
+ // TODO: what should be the status if user has refreshed the page,
46
+ // check the joinedWith parameter and communicate to the user
47
+ state: self.state,
48
+ // TODO: give a proper name . With same device as login or different login`
49
+ // Some times we might have joined with both mobile and web
50
+ joinedWith: joinedWith,
51
+ pstnDevices: pstnDevices,
52
+ // current media stats is for the current device who has joined
53
+ currentMediaStatus: SelfUtils.getMediaStatus(joinedWith === null || joinedWith === void 0 ? void 0 : joinedWith.mediaSessions),
54
+ creator: self.isCreator,
55
+ // check if its used,
56
+ selfId: self.id,
57
+ selfIdentity: SelfUtils.getSelfIdentity(self),
58
+ selfUrl: self.url,
59
+ removed: self.removed,
60
+ roles: SelfUtils.getRoles(self),
61
+ isUserUnadmitted: self.state === _constants._IDLE_ && (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent = joinedWith.intent) === null || _joinedWith$intent === void 0 ? void 0 : _joinedWith$intent.type) === _constants._WAIT_,
62
+ layout: SelfUtils.getLayout(self),
63
+ canNotViewTheParticipantList: SelfUtils.canNotViewTheParticipantList(self),
64
+ isSharingBlocked: SelfUtils.isSharingBlocked(self),
65
+ breakoutSessions: SelfUtils.getBreakoutSessions(self),
66
+ breakout: SelfUtils.getBreakout(self),
67
+ interpretation: SelfUtils.getInterpretation(self),
68
+ brb: SelfUtils.getBrb(self)
69
+ };
70
+ }
71
+ return null;
72
+ },
73
+ getBreakoutSessions: function getBreakoutSessions(self) {
74
+ var _self$controls, _self$controls$breako;
75
+ return self === null || self === void 0 ? void 0 : (_self$controls = self.controls) === null || _self$controls === void 0 ? void 0 : (_self$controls$breako = _self$controls.breakout) === null || _self$controls$breako === void 0 ? void 0 : _self$controls$breako.sessions;
76
+ },
77
+ getBreakout: function getBreakout(self) {
78
+ var _self$controls2;
79
+ return self === null || self === void 0 ? void 0 : (_self$controls2 = self.controls) === null || _self$controls2 === void 0 ? void 0 : _self$controls2.breakout;
80
+ },
81
+ getInterpretation: function getInterpretation(self) {
82
+ var _self$controls3;
83
+ return self === null || self === void 0 ? void 0 : (_self$controls3 = self.controls) === null || _self$controls3 === void 0 ? void 0 : _self$controls3.interpretation;
84
+ },
85
+ getBrb: function getBrb(self) {
86
+ var _self$controls4;
87
+ return self === null || self === void 0 ? void 0 : (_self$controls4 = self.controls) === null || _self$controls4 === void 0 ? void 0 : _self$controls4.brb;
88
+ },
89
+ getLayout: function getLayout(self) {
90
+ var _self$controls5;
91
+ return (0, _isArray.default)(self === null || self === void 0 ? void 0 : (_self$controls5 = self.controls) === null || _self$controls5 === void 0 ? void 0 : _self$controls5.layouts) ? self.controls.layouts[0].type : undefined;
92
+ },
93
+ getRoles: function getRoles(self) {
94
+ var _self$controls6, _self$controls6$role;
95
+ return ((self === null || self === void 0 ? void 0 : (_self$controls6 = self.controls) === null || _self$controls6 === void 0 ? void 0 : (_self$controls6$role = _self$controls6.role) === null || _self$controls6$role === void 0 ? void 0 : _self$controls6$role.roles) || []).reduce(function (roles, role) {
96
+ if (role.hasRole) {
97
+ roles.push(role.type);
98
+ }
99
+ return roles;
100
+ }, []);
101
+ },
102
+ canNotViewTheParticipantList: function canNotViewTheParticipantList(self) {
103
+ return !!(self !== null && self !== void 0 && self.canNotViewTheParticipantList);
104
+ },
105
+ isSharingBlocked: function isSharingBlocked(self) {
106
+ return !!(self !== null && self !== void 0 && self.isSharingBlocked);
107
+ },
108
+ getSelves: function getSelves(oldSelf, newSelf, deviceId) {
109
+ var previous = oldSelf && SelfUtils.parse(oldSelf, deviceId);
110
+ var current = newSelf && SelfUtils.parse(newSelf, deviceId);
111
+ var updates = {};
112
+ updates.isUserUnadmitted = SelfUtils.isUserUnadmitted(previous, current);
113
+ updates.isUserAdmitted = SelfUtils.isUserAdmitted(previous, current);
114
+ updates.isVideoMutedByOthersChanged = SelfUtils.videoMutedByOthersChanged(previous, current);
115
+ updates.isMutedByOthersChanged = SelfUtils.mutedByOthersChanged(previous, current);
116
+ updates.localAudioUnmuteRequestedByServer = SelfUtils.localAudioUnmuteRequestedByServer(previous, current);
117
+ updates.localAudioUnmuteRequiredByServer = SelfUtils.localAudioUnmuteRequiredByServer(previous, current);
118
+ updates.moderatorChanged = SelfUtils.moderatorChanged(previous, current);
119
+ updates.isRolesChanged = SelfUtils.isRolesChanged(previous, current);
120
+ updates.isMediaInactiveOrReleased = SelfUtils.wasMediaInactiveOrReleased(previous, current);
121
+ updates.isUserObserving = SelfUtils.isDeviceObserving(previous, current);
122
+ updates.layoutChanged = SelfUtils.layoutChanged(previous, current);
123
+ updates.isMediaInactive = SelfUtils.isMediaInactive(previous, current);
124
+ updates.audioStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.audio) !== current.currentMediaStatus.audio;
125
+ updates.videoStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.video) !== current.currentMediaStatus.video;
126
+ updates.shareStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.share) !== current.currentMediaStatus.share;
127
+ updates.canNotViewTheParticipantListChanged = (previous === null || previous === void 0 ? void 0 : previous.canNotViewTheParticipantList) !== current.canNotViewTheParticipantList;
128
+ updates.isSharingBlockedChanged = (previous === null || previous === void 0 ? void 0 : previous.isSharingBlocked) !== current.isSharingBlocked;
129
+ updates.breakoutsChanged = SelfUtils.breakoutsChanged(previous, current);
130
+ updates.interpretationChanged = SelfUtils.interpretationChanged(previous, current);
131
+ updates.brbChanged = SelfUtils.brbChanged(previous, current);
33
132
  return {
34
- remoteVideoMuted: SelfUtils.getRemoteVideoMuted(self),
35
- remoteMuted: SelfUtils.getRemoteMuted(self),
36
- unmuteAllowed: SelfUtils.getUnmuteAllowed(self),
37
- localAudioUnmuteRequested: SelfUtils.getLocalAudioUnmuteRequested(self),
38
- localAudioUnmuteRequestedTimeStamp: SelfUtils.getLocalAudioUnmuteRequestedTimeStamp(self),
39
- localAudioUnmuteRequired: SelfUtils.getLocalAudioUnmuteRequired(self),
40
- lastModified: SelfUtils.getLastModified(self),
41
- modifiedBy: SelfUtils.getModifiedBy(self),
42
- guest: self.guest,
43
- moderator: self.moderator,
44
- // cumulative media stats
45
- mediaStatus: SelfUtils.getStatus(self.status),
46
- // TODO: what should be the status if user has refreshed the page,
47
- // check the joinedWith parameter and communicate to the user
48
- state: self.state,
49
- // TODO: give a proper name . With same device as login or different login`
50
- // Some times we might have joined with both mobile and web
51
- joinedWith: joinedWith,
52
- pstnDevices: pstnDevices,
53
- // current media stats is for the current device who has joined
54
- currentMediaStatus: SelfUtils.getMediaStatus(joinedWith === null || joinedWith === void 0 ? void 0 : joinedWith.mediaSessions),
55
- creator: self.isCreator,
56
- // check if its used,
57
- selfId: self.id,
58
- selfIdentity: SelfUtils.getSelfIdentity(self),
59
- selfUrl: self.url,
60
- removed: self.removed,
61
- roles: SelfUtils.getRoles(self),
62
- isUserUnadmitted: self.state === _constants._IDLE_ && (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent = joinedWith.intent) === null || _joinedWith$intent === void 0 ? void 0 : _joinedWith$intent.type) === _constants._WAIT_,
63
- layout: SelfUtils.getLayout(self),
64
- canNotViewTheParticipantList: SelfUtils.canNotViewTheParticipantList(self),
65
- isSharingBlocked: SelfUtils.isSharingBlocked(self),
66
- breakoutSessions: SelfUtils.getBreakoutSessions(self),
67
- breakout: SelfUtils.getBreakout(self),
68
- interpretation: SelfUtils.getInterpretation(self),
69
- brb: SelfUtils.getBrb(self)
133
+ previous: previous,
134
+ current: current,
135
+ updates: updates
70
136
  };
71
- }
72
- return null;
73
- };
74
- SelfUtils.getBreakoutSessions = function (self) {
75
- var _self$controls, _self$controls$breako;
76
- return self === null || self === void 0 ? void 0 : (_self$controls = self.controls) === null || _self$controls === void 0 ? void 0 : (_self$controls$breako = _self$controls.breakout) === null || _self$controls$breako === void 0 ? void 0 : _self$controls$breako.sessions;
77
- };
78
- SelfUtils.getBreakout = function (self) {
79
- var _self$controls2;
80
- return self === null || self === void 0 ? void 0 : (_self$controls2 = self.controls) === null || _self$controls2 === void 0 ? void 0 : _self$controls2.breakout;
81
- };
82
- SelfUtils.getInterpretation = function (self) {
83
- var _self$controls3;
84
- return self === null || self === void 0 ? void 0 : (_self$controls3 = self.controls) === null || _self$controls3 === void 0 ? void 0 : _self$controls3.interpretation;
85
- };
86
- SelfUtils.getBrb = function (self) {
87
- var _self$controls4;
88
- return self === null || self === void 0 ? void 0 : (_self$controls4 = self.controls) === null || _self$controls4 === void 0 ? void 0 : _self$controls4.brb;
89
- };
90
- SelfUtils.getLayout = function (self) {
91
- var _self$controls5;
92
- return (0, _isArray.default)(self === null || self === void 0 ? void 0 : (_self$controls5 = self.controls) === null || _self$controls5 === void 0 ? void 0 : _self$controls5.layouts) ? self.controls.layouts[0].type : undefined;
93
- };
94
- SelfUtils.getRoles = function (self) {
95
- var _self$controls6, _self$controls6$role;
96
- return ((self === null || self === void 0 ? void 0 : (_self$controls6 = self.controls) === null || _self$controls6 === void 0 ? void 0 : (_self$controls6$role = _self$controls6.role) === null || _self$controls6$role === void 0 ? void 0 : _self$controls6$role.roles) || []).reduce(function (roles, role) {
97
- if (role.hasRole) {
98
- roles.push(role.type);
137
+ },
138
+ /**
139
+ * Checks if user has joined the meeting
140
+ * @param {Object} self
141
+ * @returns {boolean} isJoined
142
+ */
143
+ isJoined: function isJoined(self) {
144
+ return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
145
+ },
146
+ /**
147
+ * Validate if the Meeting Layout Controls Layout has changed.
148
+ *
149
+ * @param {Self} previous - Previous self state
150
+ * @param {Self} current - Current self state [per event]
151
+ * @returns {boolean} - If the Meeting Layout Controls Layout has changed.
152
+ */
153
+ layoutChanged: function layoutChanged(previous, current) {
154
+ return (current === null || current === void 0 ? void 0 : current.layout) && (previous === null || previous === void 0 ? void 0 : previous.layout) !== (current === null || current === void 0 ? void 0 : current.layout);
155
+ },
156
+ breakoutsChanged: function breakoutsChanged(previous, current) {
157
+ return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.breakoutSessions, current === null || current === void 0 ? void 0 : current.breakoutSessions) && !!(current !== null && current !== void 0 && current.breakout);
158
+ },
159
+ interpretationChanged: function interpretationChanged(previous, current) {
160
+ return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.interpretation, current === null || current === void 0 ? void 0 : current.interpretation) && !!(current !== null && current !== void 0 && current.interpretation);
161
+ },
162
+ brbChanged: function brbChanged(previous, current) {
163
+ return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.brb, current === null || current === void 0 ? void 0 : current.brb) && (current === null || current === void 0 ? void 0 : current.brb) !== undefined;
164
+ },
165
+ isMediaInactive: function isMediaInactive(previous, current) {
166
+ if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
167
+ var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
168
+ var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
169
+ if (previousMediaStatus.audio && currentMediaStatus.audio && previousMediaStatus.audio.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.direction !== _constants.MEDIA_STATE.inactive) {
170
+ return true;
171
+ }
172
+ if (previousMediaStatus.video && currentMediaStatus.video && previousMediaStatus.video.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.video.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.video.direction !== _constants.MEDIA_STATE.inactive) {
173
+ return true;
174
+ }
175
+ if (previousMediaStatus.share && currentMediaStatus.share && previousMediaStatus.share.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.share.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.share.direction !== _constants.MEDIA_STATE.inactive) {
176
+ return true;
177
+ }
178
+ return false;
99
179
  }
100
- return roles;
101
- }, []);
102
- };
103
- SelfUtils.canNotViewTheParticipantList = function (self) {
104
- return !!(self !== null && self !== void 0 && self.canNotViewTheParticipantList);
105
- };
106
- SelfUtils.isSharingBlocked = function (self) {
107
- return !!(self !== null && self !== void 0 && self.isSharingBlocked);
108
- };
109
- SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
110
- var previous = oldSelf && SelfUtils.parse(oldSelf, deviceId);
111
- var current = newSelf && SelfUtils.parse(newSelf, deviceId);
112
- var updates = {};
113
- updates.isUserUnadmitted = SelfUtils.isUserUnadmitted(previous, current);
114
- updates.isUserAdmitted = SelfUtils.isUserAdmitted(previous, current);
115
- updates.isVideoMutedByOthersChanged = SelfUtils.videoMutedByOthersChanged(previous, current);
116
- updates.isMutedByOthersChanged = SelfUtils.mutedByOthersChanged(previous, current);
117
- updates.localAudioUnmuteRequestedByServer = SelfUtils.localAudioUnmuteRequestedByServer(previous, current);
118
- updates.localAudioUnmuteRequiredByServer = SelfUtils.localAudioUnmuteRequiredByServer(previous, current);
119
- updates.moderatorChanged = SelfUtils.moderatorChanged(previous, current);
120
- updates.isRolesChanged = SelfUtils.isRolesChanged(previous, current);
121
- updates.isMediaInactiveOrReleased = SelfUtils.wasMediaInactiveOrReleased(previous, current);
122
- updates.isUserObserving = SelfUtils.isDeviceObserving(previous, current);
123
- updates.layoutChanged = SelfUtils.layoutChanged(previous, current);
124
- updates.isMediaInactive = SelfUtils.isMediaInactive(previous, current);
125
- updates.audioStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.audio) !== current.currentMediaStatus.audio;
126
- updates.videoStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.video) !== current.currentMediaStatus.video;
127
- updates.shareStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.share) !== current.currentMediaStatus.share;
128
- updates.canNotViewTheParticipantListChanged = (previous === null || previous === void 0 ? void 0 : previous.canNotViewTheParticipantList) !== current.canNotViewTheParticipantList;
129
- updates.isSharingBlockedChanged = (previous === null || previous === void 0 ? void 0 : previous.isSharingBlocked) !== current.isSharingBlocked;
130
- updates.breakoutsChanged = SelfUtils.breakoutsChanged(previous, current);
131
- updates.interpretationChanged = SelfUtils.interpretationChanged(previous, current);
132
- updates.brbChanged = SelfUtils.brbChanged(previous, current);
133
- return {
134
- previous: previous,
135
- current: current,
136
- updates: updates
137
- };
138
- };
139
-
140
- /**
141
- * Checks if user has joined the meeting
142
- * @param {Object} self
143
- * @returns {boolean} isJoined
144
- */
145
- SelfUtils.isJoined = function (self) {
146
- return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
147
- };
148
-
149
- /**
150
- * Validate if the Meeting Layout Controls Layout has changed.
151
- *
152
- * @param {Self} previous - Previous self state
153
- * @param {Self} current - Current self state [per event]
154
- * @returns {boolean} - If the Meeting Layout Controls Layout has changed.
155
- */
156
- SelfUtils.layoutChanged = function (previous, current) {
157
- return (current === null || current === void 0 ? void 0 : current.layout) && (previous === null || previous === void 0 ? void 0 : previous.layout) !== (current === null || current === void 0 ? void 0 : current.layout);
158
- };
159
- SelfUtils.breakoutsChanged = function (previous, current) {
160
- return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.breakoutSessions, current === null || current === void 0 ? void 0 : current.breakoutSessions) && !!(current !== null && current !== void 0 && current.breakout);
161
- };
162
- SelfUtils.interpretationChanged = function (previous, current) {
163
- return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.interpretation, current === null || current === void 0 ? void 0 : current.interpretation) && !!(current !== null && current !== void 0 && current.interpretation);
164
- };
165
- SelfUtils.brbChanged = function (previous, current) {
166
- return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.brb, current === null || current === void 0 ? void 0 : current.brb) && (current === null || current === void 0 ? void 0 : current.brb) !== undefined;
167
- };
168
- SelfUtils.isMediaInactive = function (previous, current) {
169
- if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
170
- var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
171
- var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
172
- if (previousMediaStatus.audio && currentMediaStatus.audio && previousMediaStatus.audio.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.direction !== _constants.MEDIA_STATE.inactive) {
173
- return true;
180
+ return false;
181
+ },
182
+ getLastModified: function getLastModified(self) {
183
+ if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
184
+ return null;
174
185
  }
175
- if (previousMediaStatus.video && currentMediaStatus.video && previousMediaStatus.video.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.video.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.video.direction !== _constants.MEDIA_STATE.inactive) {
176
- return true;
186
+ return self.controls.audio.meta.lastModified;
187
+ },
188
+ getModifiedBy: function getModifiedBy(self) {
189
+ if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
190
+ return null;
191
+ }
192
+ return self.controls.audio.meta.modifiedBy;
193
+ },
194
+ /**
195
+ * get the id from the self object
196
+ * @param {Object} self
197
+ * @returns {String}
198
+ */
199
+ getSelfIdentity: function getSelfIdentity(self) {
200
+ if (!self || !self.person) {
201
+ return null;
202
+ }
203
+ return self.person.id;
204
+ },
205
+ /**
206
+ * get the "remote video mute" property from the self object
207
+ * @param {Object} self
208
+ * @returns {Boolean}
209
+ */
210
+ getRemoteVideoMuted: function getRemoteVideoMuted(self) {
211
+ if (!self || !self.controls || !self.controls.video) {
212
+ return null;
213
+ }
214
+ return self.controls.video.muted;
215
+ },
216
+ /**
217
+ * get the "remote mute" property from the self object
218
+ * @param {Object} self
219
+ * @returns {Boolean}
220
+ */
221
+ getRemoteMuted: function getRemoteMuted(self) {
222
+ if (!self || !self.controls || !self.controls.audio) {
223
+ return null;
224
+ }
225
+ return self.controls.audio.muted;
226
+ },
227
+ getLocalAudioUnmuteRequested: function getLocalAudioUnmuteRequested(self) {
228
+ var _self$controls7, _self$controls7$audio;
229
+ return !!(self !== null && self !== void 0 && (_self$controls7 = self.controls) !== null && _self$controls7 !== void 0 && (_self$controls7$audio = _self$controls7.audio) !== null && _self$controls7$audio !== void 0 && _self$controls7$audio.requestedToUnmute);
230
+ },
231
+ // requestedToUnmute timestamp
232
+ getLocalAudioUnmuteRequestedTimeStamp: function getLocalAudioUnmuteRequestedTimeStamp(self) {
233
+ var _self$controls8, _self$controls8$audio;
234
+ return Date.parse(self === null || self === void 0 ? void 0 : (_self$controls8 = self.controls) === null || _self$controls8 === void 0 ? void 0 : (_self$controls8$audio = _self$controls8.audio) === null || _self$controls8$audio === void 0 ? void 0 : _self$controls8$audio.lastModifiedRequestedToUnmute) || 0;
235
+ },
236
+ getUnmuteAllowed: function getUnmuteAllowed(self) {
237
+ if (!self || !self.controls || !self.controls.audio) {
238
+ return null;
177
239
  }
178
- if (previousMediaStatus.share && currentMediaStatus.share && previousMediaStatus.share.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.share.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.share.direction !== _constants.MEDIA_STATE.inactive) {
240
+ return !self.controls.audio.disallowUnmute;
241
+ },
242
+ getLocalAudioUnmuteRequired: function getLocalAudioUnmuteRequired(self) {
243
+ var _self$controls9, _self$controls9$audio;
244
+ return !!(self !== null && self !== void 0 && (_self$controls9 = self.controls) !== null && _self$controls9 !== void 0 && (_self$controls9$audio = _self$controls9.audio) !== null && _self$controls9$audio !== void 0 && _self$controls9$audio.localAudioUnmuteRequired);
245
+ },
246
+ getStatus: function getStatus(status) {
247
+ return {
248
+ audio: status.audioStatus,
249
+ video: status.videoStatus,
250
+ slides: status.videoSlidesStatus
251
+ };
252
+ },
253
+ /**
254
+ * @param {Object} oldSelf
255
+ * @param {Object} changedSelf
256
+ * @returns {Boolean}
257
+ */
258
+ wasMediaInactiveOrReleased: function wasMediaInactiveOrReleased() {
259
+ var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
260
+ var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
261
+ return oldSelf.joinedWith && oldSelf.joinedWith.state === _constants._JOINED_ && changedSelf.joinedWith && changedSelf.joinedWith.state === _constants._LEFT_ && (changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.INACTIVE || changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.MEDIA_RELEASED);
262
+ },
263
+ /**
264
+ * @param {Object} check
265
+ * @returns {Boolean}
266
+ */
267
+ isLocusUserUnadmitted: function isLocusUserUnadmitted(check) {
268
+ var _check$joinedWith, _check$joinedWith$int;
269
+ return check && ((_check$joinedWith = check.joinedWith) === null || _check$joinedWith === void 0 ? void 0 : (_check$joinedWith$int = _check$joinedWith.intent) === null || _check$joinedWith$int === void 0 ? void 0 : _check$joinedWith$int.type) === _constants._WAIT_ && check.state === _constants._IDLE_;
270
+ },
271
+ /**
272
+ * @param {Object} check
273
+ * @returns {Boolean}
274
+ */
275
+ isLocusUserAdmitted: function isLocusUserAdmitted(check) {
276
+ var _check$joinedWith2, _check$joinedWith2$in;
277
+ return check && ((_check$joinedWith2 = check.joinedWith) === null || _check$joinedWith2 === void 0 ? void 0 : (_check$joinedWith2$in = _check$joinedWith2.intent) === null || _check$joinedWith2$in === void 0 ? void 0 : _check$joinedWith2$in.type) !== _constants._WAIT_ && check.state === _constants._JOINED_;
278
+ },
279
+ /**
280
+ * @param {Object} oldSelf
281
+ * @param {Object} changedSelf
282
+ * @returns {Boolean}
283
+ * @throws {Error} when self is undefined
284
+ */
285
+ isUserUnadmitted: function isUserUnadmitted(oldSelf, changedSelf) {
286
+ if (!changedSelf) {
287
+ throw new _parameter.default('changedSelf must be defined to determine if self is unadmitted as guest.');
288
+ }
289
+ if (SelfUtils.isLocusUserUnadmitted(oldSelf)) {
290
+ return false;
291
+ }
292
+ return SelfUtils.isLocusUserUnadmitted(changedSelf);
293
+ },
294
+ moderatorChanged: function moderatorChanged(oldSelf, changedSelf) {
295
+ if (!oldSelf) {
179
296
  return true;
180
297
  }
181
- return false;
182
- }
183
- return false;
184
- };
185
- SelfUtils.getLastModified = function (self) {
186
- if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
187
- return null;
188
- }
189
- return self.controls.audio.meta.lastModified;
190
- };
191
- SelfUtils.getModifiedBy = function (self) {
192
- if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
193
- return null;
194
- }
195
- return self.controls.audio.meta.modifiedBy;
196
- };
197
-
198
- /**
199
- * get the id from the self object
200
- * @param {Object} self
201
- * @returns {String}
202
- */
203
- SelfUtils.getSelfIdentity = function (self) {
204
- if (!self && !self.person) {
205
- return null;
206
- }
207
- return self.person.id;
208
- };
209
-
210
- /**
211
- * get the "remote video mute" property from the self object
212
- * @param {Object} self
213
- * @returns {Boolean}
214
- */
215
- SelfUtils.getRemoteVideoMuted = function (self) {
216
- if (!self || !self.controls || !self.controls.video) {
217
- return null;
218
- }
219
- return self.controls.video.muted;
220
- };
221
-
222
- /**
223
- * get the "remote mute" property from the self object
224
- * @param {Object} self
225
- * @returns {Boolean}
226
- */
227
- SelfUtils.getRemoteMuted = function (self) {
228
- if (!self || !self.controls || !self.controls.audio) {
229
- return null;
230
- }
231
- return self.controls.audio.muted;
232
- };
233
- SelfUtils.getLocalAudioUnmuteRequested = function (self) {
234
- var _self$controls7, _self$controls7$audio;
235
- return !!(self !== null && self !== void 0 && (_self$controls7 = self.controls) !== null && _self$controls7 !== void 0 && (_self$controls7$audio = _self$controls7.audio) !== null && _self$controls7$audio !== void 0 && _self$controls7$audio.requestedToUnmute);
236
- };
237
-
238
- // requestedToUnmute timestamp
239
- SelfUtils.getLocalAudioUnmuteRequestedTimeStamp = function (self) {
240
- var _self$controls8, _self$controls8$audio;
241
- return Date.parse(self === null || self === void 0 ? void 0 : (_self$controls8 = self.controls) === null || _self$controls8 === void 0 ? void 0 : (_self$controls8$audio = _self$controls8.audio) === null || _self$controls8$audio === void 0 ? void 0 : _self$controls8$audio.lastModifiedRequestedToUnmute) || 0;
242
- };
243
- SelfUtils.getUnmuteAllowed = function (self) {
244
- if (!self || !self.controls || !self.controls.audio) {
245
- return null;
246
- }
247
- return !self.controls.audio.disallowUnmute;
248
- };
249
- SelfUtils.getLocalAudioUnmuteRequired = function (self) {
250
- var _self$controls9, _self$controls9$audio;
251
- return !!(self !== null && self !== void 0 && (_self$controls9 = self.controls) !== null && _self$controls9 !== void 0 && (_self$controls9$audio = _self$controls9.audio) !== null && _self$controls9$audio !== void 0 && _self$controls9$audio.localAudioUnmuteRequired);
252
- };
253
- SelfUtils.getStatus = function (status) {
254
- return {
255
- audio: status.audioStatus,
256
- video: status.videoStatus,
257
- slides: status.videoSlidesStatus
258
- };
259
- };
260
-
261
- /**
262
- * @param {Object} oldSelf
263
- * @param {Object} changedSelf
264
- * @returns {Boolean}
265
- */
266
- SelfUtils.wasMediaInactiveOrReleased = function () {
267
- var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
268
- var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
269
- return oldSelf.joinedWith && oldSelf.joinedWith.state === _constants._JOINED_ && changedSelf.joinedWith && changedSelf.joinedWith.state === _constants._LEFT_ && (changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.INACTIVE || changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.MEDIA_RELEASED);
270
- };
271
-
272
- /**
273
- * @param {Object} check
274
- * @returns {Boolean}
275
- */
276
- SelfUtils.isLocusUserUnadmitted = function (check) {
277
- var _check$joinedWith, _check$joinedWith$int;
278
- return check && ((_check$joinedWith = check.joinedWith) === null || _check$joinedWith === void 0 ? void 0 : (_check$joinedWith$int = _check$joinedWith.intent) === null || _check$joinedWith$int === void 0 ? void 0 : _check$joinedWith$int.type) === _constants._WAIT_ && check.state === _constants._IDLE_;
279
- };
280
-
281
- /**
282
- * @param {Object} check
283
- * @returns {Boolean}
284
- */
285
- SelfUtils.isLocusUserAdmitted = function (check) {
286
- var _check$joinedWith2, _check$joinedWith2$in;
287
- return check && ((_check$joinedWith2 = check.joinedWith) === null || _check$joinedWith2 === void 0 ? void 0 : (_check$joinedWith2$in = _check$joinedWith2.intent) === null || _check$joinedWith2$in === void 0 ? void 0 : _check$joinedWith2$in.type) !== _constants._WAIT_ && check.state === _constants._JOINED_;
288
- };
289
-
290
- /**
291
- * @param {Object} oldSelf
292
- * @param {Object} changedSelf
293
- * @returns {Boolean}
294
- * @throws {Error} when self is undefined
295
- */
296
- SelfUtils.isUserUnadmitted = function (oldSelf, changedSelf) {
297
- if (!changedSelf) {
298
- throw new _parameter.default('changedSelf must be defined to determine if self is unadmitted as guest.');
299
- }
300
- if (SelfUtils.isLocusUserUnadmitted(oldSelf)) {
301
- return false;
302
- }
303
- return SelfUtils.isLocusUserUnadmitted(changedSelf);
304
- };
305
- SelfUtils.moderatorChanged = function (oldSelf, changedSelf) {
306
- if (!oldSelf) {
307
- return true;
308
- }
309
- if (!changedSelf) {
310
- throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
311
- }
312
- return oldSelf.moderator !== changedSelf.moderator;
313
- };
314
-
315
- /**
316
- * determine whether the roles of self is changed or not
317
- * @param {Object} oldSelf
318
- * @param {Object} changedSelf
319
- * @returns {Boolean}
320
- */
321
- SelfUtils.isRolesChanged = function (oldSelf, changedSelf) {
322
- if (!changedSelf) {
323
- // no new self means no change
324
- return false;
325
- }
326
- return !(0, _lodash.isEqual)(oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.roles, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.roles);
327
- };
328
- /**
329
- * @param {Object} oldSelf
330
- * @param {Object} changedSelf
331
- * @returns {Boolean}
332
- * @throws {Error} if changed self was undefined
333
- */
334
- SelfUtils.isDeviceObserving = function (oldSelf, changedSelf) {
335
- var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
336
- return oldSelf && ((_oldSelf$joinedWith = oldSelf.joinedWith) === null || _oldSelf$joinedWith === void 0 ? void 0 : (_oldSelf$joinedWith$i = _oldSelf$joinedWith.intent) === null || _oldSelf$joinedWith$i === void 0 ? void 0 : _oldSelf$joinedWith$i.type) === _constants._MOVE_MEDIA_ && changedSelf && ((_changedSelf$joinedWi = changedSelf.joinedWith) === null || _changedSelf$joinedWi === void 0 ? void 0 : (_changedSelf$joinedWi2 = _changedSelf$joinedWi.intent) === null || _changedSelf$joinedWi2 === void 0 ? void 0 : _changedSelf$joinedWi2.type) === _constants._OBSERVE_;
337
- };
338
-
339
- /**
340
- * @param {Object} oldSelf
341
- * @param {Object} changedSelf
342
- * @returns {Boolean}
343
- * @throws {Error} if changed self was undefined
344
- */
345
- SelfUtils.isUserAdmitted = function (oldSelf, changedSelf) {
346
- if (!oldSelf) {
347
- // if there was no previous locus, it couldn't have been admitted yet
348
- return false;
349
- }
350
- if (!changedSelf) {
351
- throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
352
- }
353
- return SelfUtils.isLocusUserUnadmitted(oldSelf) && SelfUtils.isLocusUserAdmitted(changedSelf);
354
- };
355
- SelfUtils.videoMutedByOthersChanged = function (oldSelf, changedSelf) {
356
- if (!changedSelf) {
357
- throw new _parameter.default('New self must be defined to determine if self was video muted by others.');
358
- }
359
- if (!oldSelf || oldSelf.remoteVideoMuted === null) {
360
- if (changedSelf.remoteVideoMuted) {
361
- return true; // this happens when host disables "Allow start video"
298
+ if (!changedSelf) {
299
+ throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
362
300
  }
363
-
364
- // we don't want to be sending the 'meeting:self:videoUnmutedByOthers' notification on meeting join
365
- return false;
366
- }
367
- return oldSelf.remoteVideoMuted !== changedSelf.remoteVideoMuted;
368
- };
369
- SelfUtils.mutedByOthersChanged = function (oldSelf, changedSelf) {
370
- if (!changedSelf) {
371
- throw new _parameter.default('New self must be defined to determine if self was muted by others.');
372
- }
373
- if (!oldSelf || oldSelf.remoteMuted === null) {
374
- if (changedSelf.remoteMuted) {
375
- return true; // this happens when mute on-entry is enabled
301
+ return oldSelf.moderator !== changedSelf.moderator;
302
+ },
303
+ /**
304
+ * determine whether the roles of self is changed or not
305
+ * @param {Object} oldSelf
306
+ * @param {Object} changedSelf
307
+ * @returns {Boolean}
308
+ */
309
+ isRolesChanged: function isRolesChanged(oldSelf, changedSelf) {
310
+ if (!changedSelf) {
311
+ // no new self means no change
312
+ return false;
313
+ }
314
+ return !(0, _lodash.isEqual)(oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.roles, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.roles);
315
+ },
316
+ /**
317
+ * @param {Object} oldSelf
318
+ * @param {Object} changedSelf
319
+ * @returns {Boolean}
320
+ * @throws {Error} if changed self was undefined
321
+ */
322
+ isDeviceObserving: function isDeviceObserving(oldSelf, changedSelf) {
323
+ var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
324
+ return oldSelf && ((_oldSelf$joinedWith = oldSelf.joinedWith) === null || _oldSelf$joinedWith === void 0 ? void 0 : (_oldSelf$joinedWith$i = _oldSelf$joinedWith.intent) === null || _oldSelf$joinedWith$i === void 0 ? void 0 : _oldSelf$joinedWith$i.type) === _constants._MOVE_MEDIA_ && changedSelf && ((_changedSelf$joinedWi = changedSelf.joinedWith) === null || _changedSelf$joinedWi === void 0 ? void 0 : (_changedSelf$joinedWi2 = _changedSelf$joinedWi.intent) === null || _changedSelf$joinedWi2 === void 0 ? void 0 : _changedSelf$joinedWi2.type) === _constants._OBSERVE_;
325
+ },
326
+ /**
327
+ * @param {Object} oldSelf
328
+ * @param {Object} changedSelf
329
+ * @returns {Boolean}
330
+ * @throws {Error} if changed self was undefined
331
+ */
332
+ isUserAdmitted: function isUserAdmitted(oldSelf, changedSelf) {
333
+ if (!oldSelf) {
334
+ // if there was no previous locus, it couldn't have been admitted yet
335
+ return false;
376
336
  }
337
+ if (!changedSelf) {
338
+ throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
339
+ }
340
+ return SelfUtils.isLocusUserUnadmitted(oldSelf) && SelfUtils.isLocusUserAdmitted(changedSelf);
341
+ },
342
+ videoMutedByOthersChanged: function videoMutedByOthersChanged(oldSelf, changedSelf) {
343
+ if (!changedSelf) {
344
+ throw new _parameter.default('New self must be defined to determine if self was video muted by others.');
345
+ }
346
+ if (!oldSelf || oldSelf.remoteVideoMuted === null) {
347
+ if (changedSelf.remoteVideoMuted) {
348
+ return true; // this happens when host disables "Allow start video"
349
+ }
377
350
 
378
- // we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
379
- return false;
380
- }
351
+ // we don't want to be sending the 'meeting:self:videoUnmutedByOthers' notification on meeting join
352
+ return false;
353
+ }
354
+ return oldSelf.remoteVideoMuted !== changedSelf.remoteVideoMuted;
355
+ },
356
+ mutedByOthersChanged: function mutedByOthersChanged(oldSelf, changedSelf) {
357
+ if (!changedSelf) {
358
+ throw new _parameter.default('New self must be defined to determine if self was muted by others.');
359
+ }
360
+ if (!oldSelf || oldSelf.remoteMuted === null) {
361
+ if (changedSelf.remoteMuted) {
362
+ return true; // this happens when mute on-entry is enabled
363
+ }
381
364
 
382
- // there is no need to trigger user update if no one muted user
383
- if (changedSelf.selfIdentity === changedSelf.modifiedBy) {
384
- return false;
385
- }
386
- return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
387
- };
388
- SelfUtils.localAudioUnmuteRequestedByServer = function () {
389
- var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
390
- var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
391
- if (!changedSelf) {
392
- throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
393
- }
394
- return changedSelf.localAudioUnmuteRequested && changedSelf.localAudioUnmuteRequestedTimeStamp > oldSelf.localAudioUnmuteRequestedTimeStamp;
395
- };
396
- SelfUtils.localAudioUnmuteRequiredByServer = function () {
397
- var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
398
- var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
399
- if (!changedSelf) {
400
- throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
401
- }
402
- return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
403
- };
365
+ // we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
366
+ return false;
367
+ }
404
368
 
405
- /**
406
- * extract the sipUrl from the partner
407
- * @param {Object} partner
408
- * @param {Object} info
409
- * @returns {Object}
410
- */
369
+ // there is no need to trigger user update if no one muted user
370
+ if (changedSelf.selfIdentity === changedSelf.modifiedBy) {
371
+ return false;
372
+ }
373
+ return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
374
+ },
375
+ localAudioUnmuteRequestedByServer: function localAudioUnmuteRequestedByServer() {
376
+ var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
377
+ var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
378
+ if (!changedSelf) {
379
+ throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
380
+ }
381
+ return changedSelf.localAudioUnmuteRequested && changedSelf.localAudioUnmuteRequestedTimeStamp > oldSelf.localAudioUnmuteRequestedTimeStamp;
382
+ },
383
+ localAudioUnmuteRequiredByServer: function localAudioUnmuteRequiredByServer() {
384
+ var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
385
+ var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
386
+ if (!changedSelf) {
387
+ throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
388
+ }
389
+ return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
390
+ },
391
+ /**
392
+ * extract the sipUrl from the partner
393
+ * @param {Object} partner
394
+ * @param {Object} info
395
+ * @returns {Object}
396
+ */
411
397
 
412
- SelfUtils.getSipUrl = function (partner, type, sipUri) {
413
- // For webex meeting the sipUrl gets updated in info parser
414
- if (partner && type === _constants._CALL_) {
398
+ getSipUrl: function getSipUrl(partner, type, sipUri) {
399
+ // For webex meeting the sipUrl gets updated in info parser
400
+ if (partner && type === _constants._CALL_) {
401
+ return {
402
+ sipUri: partner.person.sipUrl || partner.person.id
403
+ };
404
+ }
415
405
  return {
416
- sipUri: partner.person.sipUrl || partner.person.id
406
+ sipUri: sipUri
417
407
  };
418
- }
419
- return {
420
- sipUri: sipUri
421
- };
422
- };
423
- SelfUtils.getMediaStatus = function () {
424
- var mediaSessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
425
- var mediaStatus = {
426
- audio: {},
427
- video: {},
428
- share: {}
429
- };
430
- mediaStatus.audio = mediaSessions.find(function (media) {
431
- return media.mediaType === _constants.AUDIO && media.mediaContent === _constants.MediaContent.main;
432
- });
433
- mediaStatus.video = mediaSessions.find(function (media) {
434
- return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.main;
435
- });
436
- mediaStatus.share = mediaSessions.find(function (media) {
437
- return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.slides;
438
- });
439
- return mediaStatus;
440
- };
441
- SelfUtils.getReplacedBreakoutMoveId = function (self, deviceId) {
442
- if (self && (0, _isArray.default)(self.devices)) {
443
- var joinedDevice = self.devices.find(function (device) {
444
- return deviceId === device.url;
408
+ },
409
+ getMediaStatus: function getMediaStatus() {
410
+ var mediaSessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
411
+ var mediaStatus = {
412
+ audio: {},
413
+ video: {},
414
+ share: {}
415
+ };
416
+ mediaStatus.audio = mediaSessions.find(function (media) {
417
+ return media.mediaType === _constants.AUDIO && media.mediaContent === _constants.MediaContent.main;
445
418
  });
446
- if ((0, _isArray.default)(joinedDevice === null || joinedDevice === void 0 ? void 0 : joinedDevice.replaces)) {
447
- var _joinedDevice$replace;
448
- return (_joinedDevice$replace = joinedDevice.replaces[0]) === null || _joinedDevice$replace === void 0 ? void 0 : _joinedDevice$replace.breakoutMoveId;
419
+ mediaStatus.video = mediaSessions.find(function (media) {
420
+ return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.main;
421
+ });
422
+ mediaStatus.share = mediaSessions.find(function (media) {
423
+ return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.slides;
424
+ });
425
+ return mediaStatus;
426
+ },
427
+ getReplacedBreakoutMoveId: function getReplacedBreakoutMoveId(self, deviceId) {
428
+ if (self && (0, _isArray.default)(self.devices)) {
429
+ var joinedDevice = self.devices.find(function (device) {
430
+ return deviceId === device.url;
431
+ });
432
+ if ((0, _isArray.default)(joinedDevice === null || joinedDevice === void 0 ? void 0 : joinedDevice.replaces)) {
433
+ var _joinedDevice$replace;
434
+ return (_joinedDevice$replace = joinedDevice.replaces[0]) === null || _joinedDevice$replace === void 0 ? void 0 : _joinedDevice$replace.breakoutMoveId;
435
+ }
449
436
  }
437
+ return null;
450
438
  }
451
- return null;
452
439
  };
453
440
  var _default = exports.default = SelfUtils;
454
441
  //# sourceMappingURL=selfUtils.js.map