mediasfu-shared 1.0.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.
- package/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/index.cjs +7707 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7285 -0
- package/dist/index.js +7690 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -0
- package/src/ProducerClient/producerClientEmits/createDeviceClient.ts +68 -0
- package/src/consumers/addVideosGrid.ts +18 -0
- package/src/consumers/autoAdjust.ts +100 -0
- package/src/consumers/calculateRowsAndColumns.ts +51 -0
- package/src/consumers/changeVids.ts +753 -0
- package/src/consumers/checkGrid.ts +100 -0
- package/src/consumers/checkPermission.ts +89 -0
- package/src/consumers/checkScreenShare.ts +114 -0
- package/src/consumers/closeAndResize.ts +401 -0
- package/src/consumers/compareActiveNames.ts +122 -0
- package/src/consumers/compareScreenStates.ts +117 -0
- package/src/consumers/connectIps.ts +175 -0
- package/src/consumers/connectLocalIps.ts +103 -0
- package/src/consumers/connectRecvTransport.ts +158 -0
- package/src/consumers/connectSendTransport.ts +150 -0
- package/src/consumers/connectSendTransportAudio.ts +161 -0
- package/src/consumers/connectSendTransportScreen.ts +169 -0
- package/src/consumers/connectSendTransportVideo.ts +149 -0
- package/src/consumers/consumerResume.ts +25 -0
- package/src/consumers/controlMedia.ts +118 -0
- package/src/consumers/createSendTransport.ts +312 -0
- package/src/consumers/disconnectSendTransportAudio.ts +170 -0
- package/src/consumers/disconnectSendTransportScreen.ts +130 -0
- package/src/consumers/disconnectSendTransportVideo.ts +161 -0
- package/src/consumers/dispStreams.ts +694 -0
- package/src/consumers/generatePageContent.ts +118 -0
- package/src/consumers/getEstimate.ts +124 -0
- package/src/consumers/getPipedProducersAlt.ts +96 -0
- package/src/consumers/getProducersPiped.ts +89 -0
- package/src/consumers/getVideos.ts +107 -0
- package/src/consumers/mixStreams.ts +97 -0
- package/src/consumers/onScreenChanges.ts +106 -0
- package/src/consumers/prepopulateUserMedia.ts +18 -0
- package/src/consumers/processConsumerTransports.ts +157 -0
- package/src/consumers/processConsumerTransportsAudio.ts +121 -0
- package/src/consumers/rePort.ts +123 -0
- package/src/consumers/reUpdateInter.ts +289 -0
- package/src/consumers/readjust.ts +170 -0
- package/src/consumers/receiveAllPipedTransports.ts +77 -0
- package/src/consumers/receiveRoomMessages.ts +55 -0
- package/src/consumers/reorderStreams.ts +246 -0
- package/src/consumers/requestScreenShare.ts +103 -0
- package/src/consumers/resumePauseAudioStreams.ts +174 -0
- package/src/consumers/resumePauseStreams.ts +110 -0
- package/src/consumers/resumeSendTransportAudio.ts +143 -0
- package/src/consumers/signalNewConsumerTransport.ts +179 -0
- package/src/consumers/socketReceiveMethods/joinConsumeRoom.ts +130 -0
- package/src/consumers/socketReceiveMethods/newPipeProducer.ts +138 -0
- package/src/consumers/socketReceiveMethods/producerClosed.ts +102 -0
- package/src/consumers/startShareScreen.ts +124 -0
- package/src/consumers/stopShareScreen.ts +241 -0
- package/src/consumers/streamSuccessAudio.ts +297 -0
- package/src/consumers/streamSuccessAudioSwitch.ts +315 -0
- package/src/consumers/streamSuccessScreen.ts +255 -0
- package/src/consumers/streamSuccessVideo.ts +373 -0
- package/src/consumers/switchUserAudio.ts +140 -0
- package/src/consumers/switchUserVideo.ts +201 -0
- package/src/consumers/switchUserVideoAlt.ts +331 -0
- package/src/consumers/trigger.ts +250 -0
- package/src/consumers/updateMiniCardsGrid.ts +150 -0
- package/src/consumers/updateParticipantAudioDecibels.ts +56 -0
- package/src/index.ts +119 -0
- package/src/methods/background/launchBackground.ts +16 -0
- package/src/methods/breakoutRooms/breakoutRoomUpdated.ts +161 -0
- package/src/methods/breakoutRooms/handleStartBreakout.ts +96 -0
- package/src/methods/breakoutRooms/handleStopBreakout.ts +72 -0
- package/src/methods/breakoutRooms/index.ts +4 -0
- package/src/methods/breakoutRooms/launchBreakoutRooms.ts +31 -0
- package/src/methods/coHost/launchCoHost.ts +28 -0
- package/src/methods/coHostMethods/index.ts +2 -0
- package/src/methods/coHostMethods/modifyCoHostSettings.ts +94 -0
- package/src/methods/displaySettings/index.ts +1 -0
- package/src/methods/displaySettings/launchDisplaySettings.ts +31 -0
- package/src/methods/displaySettings/modifyDisplaySettings.ts +242 -0
- package/src/methods/exit/confirmExit.ts +60 -0
- package/src/methods/exit/index.ts +2 -0
- package/src/methods/exit/launchConfirmExit.ts +29 -0
- package/src/methods/index.ts +5 -0
- package/src/methods/mediaSettings/launchMediaSettings.ts +61 -0
- package/src/methods/menu/launchMenuModal.ts +28 -0
- package/src/methods/message/index.ts +1 -0
- package/src/methods/message/launchMessages.ts +27 -0
- package/src/methods/message/sendMessage.ts +175 -0
- package/src/methods/participants/index.ts +3 -0
- package/src/methods/participants/launchParticipants.ts +25 -0
- package/src/methods/participants/messageParticipants.ts +78 -0
- package/src/methods/participants/muteParticipants.ts +79 -0
- package/src/methods/participants/removeParticipants.ts +97 -0
- package/src/methods/polls/handleCreatePoll.ts +66 -0
- package/src/methods/polls/handleEndPoll.ts +64 -0
- package/src/methods/polls/handleVotePoll.ts +76 -0
- package/src/methods/polls/index.ts +3 -0
- package/src/methods/polls/launchPoll.ts +25 -0
- package/src/methods/prejoin/handleCreateRoom.ts +441 -0
- package/src/methods/prejoin/handleJoinRoom.ts +153 -0
- package/src/methods/prejoin/index.ts +14 -0
- package/src/methods/recording/checkPauseState.ts +57 -0
- package/src/methods/recording/checkResumeState.ts +42 -0
- package/src/methods/recording/confirmRecording.ts +241 -0
- package/src/methods/recording/launchRecording.ts +114 -0
- package/src/methods/recording/recordPauseTimer.ts +52 -0
- package/src/methods/recording/recordResumeTimer.ts +92 -0
- package/src/methods/recording/recordStartTimer.ts +106 -0
- package/src/methods/recording/recordUpdateTimer.ts +49 -0
- package/src/methods/recording/startRecording.ts +268 -0
- package/src/methods/recording/stopRecording.ts +124 -0
- package/src/methods/recording/updateRecording.ts +245 -0
- package/src/methods/requests/index.ts +1 -0
- package/src/methods/requests/launchRequests.ts +25 -0
- package/src/methods/requests/respondToRequests.ts +108 -0
- package/src/methods/settings/index.ts +2 -0
- package/src/methods/settings/launchSettings.ts +25 -0
- package/src/methods/settings/modifySettings.ts +99 -0
- package/src/methods/stream/clickVideo.ts +337 -0
- package/src/methods/stream/index.ts +3 -0
- package/src/methods/stream/switchAudio.ts +73 -0
- package/src/methods/stream/switchVideo.ts +148 -0
- package/src/methods/stream/switchVideoAlt.ts +152 -0
- package/src/methods/utils/checkLimitsAndMakeRequest.ts +103 -0
- package/src/methods/utils/validateAlphanumeric.ts +41 -0
- package/src/methods/waiting/index.ts +1 -0
- package/src/methods/waiting/launchWaiting.ts +26 -0
- package/src/methods/waiting/respondToWaiting.ts +82 -0
- package/src/methods/welcome/handleWelcomeRequest.ts +189 -0
- package/src/methods/welcome/index.ts +5 -0
- package/src/methods/whiteboard/handleStartWhiteboard.ts +65 -0
- package/src/methods/whiteboard/handleStopWhiteboard.ts +48 -0
- package/src/methods/whiteboard/index.ts +4 -0
- package/src/methods/whiteboard/launchConfigureWhiteboard.ts +29 -0
- package/src/producers/producerEmits/joinConRoom.ts +153 -0
- package/src/sockets/SocketManager.ts +232 -0
- package/src/types/shared-base-types.ts +752 -0
- package/src/types/types.ts +84 -0
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { Stream, Participant, DispStreamsType, DispStreamsParameters, AudioDecibels, MixStreamsType, BreakoutParticipant, EventType } from "../types/types";
|
|
4
|
+
|
|
5
|
+
export interface ChangeVidsParameters extends DispStreamsParameters {
|
|
6
|
+
|
|
7
|
+
allVideoStreams: (Stream | Participant)[];
|
|
8
|
+
p_activeNames: string[];
|
|
9
|
+
activeNames: string[];
|
|
10
|
+
dispActiveNames: string[];
|
|
11
|
+
shareScreenStarted: boolean;
|
|
12
|
+
shared: boolean;
|
|
13
|
+
newLimitedStreams: (Stream | Participant)[];
|
|
14
|
+
non_alVideoStreams: Participant[];
|
|
15
|
+
ref_participants: Participant[];
|
|
16
|
+
participants: Participant[];
|
|
17
|
+
eventType: EventType;
|
|
18
|
+
islevel: string;
|
|
19
|
+
member: string;
|
|
20
|
+
sortAudioLoudness: boolean;
|
|
21
|
+
audioDecibels: AudioDecibels[];
|
|
22
|
+
mixed_alVideoStreams: (Stream | Participant)[];
|
|
23
|
+
non_alVideoStreams_muted: Participant[];
|
|
24
|
+
remoteProducerId?: string;
|
|
25
|
+
localStreamVideo: MediaStream | null;
|
|
26
|
+
oldAllStreams: (Stream | Participant)[];
|
|
27
|
+
screenPageLimit: number;
|
|
28
|
+
meetingDisplayType: string;
|
|
29
|
+
meetingVideoOptimized: boolean;
|
|
30
|
+
recordingVideoOptimized: boolean;
|
|
31
|
+
recordingDisplayType: "video" | "media" | "all";
|
|
32
|
+
paginatedStreams: (Stream | Participant)[][];
|
|
33
|
+
itemPageLimit: number;
|
|
34
|
+
doPaginate: boolean;
|
|
35
|
+
prevDoPaginate: boolean;
|
|
36
|
+
currentUserPage: number;
|
|
37
|
+
breakoutRooms: BreakoutParticipant[][];
|
|
38
|
+
hostNewRoom: number;
|
|
39
|
+
breakOutRoomStarted: boolean;
|
|
40
|
+
breakOutRoomEnded: boolean;
|
|
41
|
+
virtualStream: MediaStream | null;
|
|
42
|
+
mainRoomsLength: number;
|
|
43
|
+
memberRoom: number;
|
|
44
|
+
updateP_activeNames: (names: string[]) => void;
|
|
45
|
+
updateActiveNames: (names: string[]) => void;
|
|
46
|
+
updateDispActiveNames: (names: string[]) => void;
|
|
47
|
+
updateNewLimitedStreams: (streams: (Stream | Participant)[]) => void;
|
|
48
|
+
updateNon_alVideoStreams: (participants: Participant[]) => void;
|
|
49
|
+
updateRef_participants: (participants: Participant[]) => void;
|
|
50
|
+
updateSortAudioLoudness: (sort: boolean) => void;
|
|
51
|
+
updateMixed_alVideoStreams: (streams: (Stream | Participant)[]) => void;
|
|
52
|
+
updateNon_alVideoStreams_muted: (participants: Participant[]) => void;
|
|
53
|
+
updatePaginatedStreams: (streams: (Stream | Participant)[][]) => void;
|
|
54
|
+
updateDoPaginate: (paginate: boolean) => void;
|
|
55
|
+
updatePrevDoPaginate: (paginate: boolean) => void;
|
|
56
|
+
updateCurrentUserPage: (page: number) => void;
|
|
57
|
+
updateNumberPages: (pages: number) => void;
|
|
58
|
+
updateMainRoomsLength: (length: number) => void;
|
|
59
|
+
updateMemberRoom: (room: number) => void;
|
|
60
|
+
|
|
61
|
+
// mediasfu functions
|
|
62
|
+
mixStreams: MixStreamsType;
|
|
63
|
+
dispStreams: DispStreamsType;
|
|
64
|
+
getUpdatedAllParams: () => ChangeVidsParameters;
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ChangeVidsOptions {
|
|
70
|
+
screenChanged?: boolean;
|
|
71
|
+
parameters: ChangeVidsParameters;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Export the type definition for the function
|
|
75
|
+
export type ChangeVidsType = (options: ChangeVidsOptions) => Promise<void>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Asynchronously changes the video streams based on the provided options.
|
|
79
|
+
*
|
|
80
|
+
* @function
|
|
81
|
+
* @param {ChangeVidsOptions} options - The options for changing video streams.
|
|
82
|
+
* @param {boolean} [options.screenChanged=false] - Indicates if the screen has changed.
|
|
83
|
+
* @param {ChangeVidsParameters} options.parameters - The parameters for changing video streams.
|
|
84
|
+
* @returns {Promise<void>} A promise that resolves when the video streams have been changed.
|
|
85
|
+
*
|
|
86
|
+
* @typedef {Object} ChangeVidsOptions
|
|
87
|
+
* @property {Function} getUpdatedAllParams - Function to get updated parameters.
|
|
88
|
+
* @property {Array} allVideoStreams - Array of all video streams.
|
|
89
|
+
* @property {Array} p_activeNames - Array of active participant names.
|
|
90
|
+
* @property {Array} activeNames - Array of active names.
|
|
91
|
+
* @property {Array} dispActiveNames - Array of displayed active names.
|
|
92
|
+
* @property {boolean} shareScreenStarted - Indicates if screen sharing has started.
|
|
93
|
+
* @property {boolean} shared - Indicates if the screen is shared.
|
|
94
|
+
* @property {Array} newLimitedStreams - Array of new limited streams.
|
|
95
|
+
* @property {Array} non_alVideoStreams - Array of non-al video streams.
|
|
96
|
+
* @property {Array} ref_participants - Array of reference participants.
|
|
97
|
+
* @property {Array} participants - Array of participants.
|
|
98
|
+
* @property {string} eventType - Type of the event.
|
|
99
|
+
* @property {string} islevel - Level of the participant.
|
|
100
|
+
* @property {string} member - Name of the member.
|
|
101
|
+
* @property {boolean} sortAudioLoudness - Indicates if audio loudness should be sorted.
|
|
102
|
+
* @property {Array} audioDecibels - Array of audio decibels.
|
|
103
|
+
* @property {Array} mixed_alVideoStreams - Array of mixed al video streams.
|
|
104
|
+
* @property {Array} non_alVideoStreams_muted - Array of muted non-al video streams.
|
|
105
|
+
* @property {string} remoteProducerId - ID of the remote producer.
|
|
106
|
+
* @property {Object} localStreamVideo - Local stream video object.
|
|
107
|
+
* @property {Array} oldAllStreams - Array of old all streams.
|
|
108
|
+
* @property {number} screenPageLimit - Limit of streams per screen page.
|
|
109
|
+
* @property {string} meetingDisplayType - Type of meeting display.
|
|
110
|
+
* @property {boolean} meetingVideoOptimized - Indicates if meeting video is optimized.
|
|
111
|
+
* @property {boolean} recordingVideoOptimized - Indicates if recording video is optimized.
|
|
112
|
+
* @property {string} recordingDisplayType - Type of recording display.
|
|
113
|
+
* @property {Array} paginatedStreams - Array of paginated streams.
|
|
114
|
+
* @property {number} itemPageLimit - Limit of items per page.
|
|
115
|
+
* @property {boolean} doPaginate - Indicates if pagination should be done.
|
|
116
|
+
* @property {boolean} prevDoPaginate - Indicates if pagination was previously done.
|
|
117
|
+
* @property {number} currentUserPage - Current user page number.
|
|
118
|
+
* @property {Array} breakoutRooms - Array of breakout rooms.
|
|
119
|
+
* @property {number} hostNewRoom - Index of the new room for the host.
|
|
120
|
+
* @property {boolean} breakOutRoomStarted - Indicates if breakout room has started.
|
|
121
|
+
* @property {boolean} breakOutRoomEnded - Indicates if breakout room has ended.
|
|
122
|
+
* @property {Object} virtualStream - Virtual stream object.
|
|
123
|
+
* @property {number} mainRoomsLength - Length of main rooms.
|
|
124
|
+
* @property {number} memberRoom - Room of the member.
|
|
125
|
+
* @property {Function} updateP_activeNames - Function to update active participant names.
|
|
126
|
+
* @property {Function} updateActiveNames - Function to update active names.
|
|
127
|
+
* @property {Function} updateDispActiveNames - Function to update displayed active names.
|
|
128
|
+
* @property {Function} updateNewLimitedStreams - Function to update new limited streams.
|
|
129
|
+
* @property {Function} updateNon_alVideoStreams - Function to update non-al video streams.
|
|
130
|
+
* @property {Function} updateRef_participants - Function to update reference participants.
|
|
131
|
+
* @property {Function} updateSortAudioLoudness - Function to update audio loudness sorting.
|
|
132
|
+
* @property {Function} updateMixed_alVideoStreams - Function to update mixed al video streams.
|
|
133
|
+
* @property {Function} updateNon_alVideoStreams_muted - Function to update muted non-al video streams.
|
|
134
|
+
* @property {Function} updatePaginatedStreams - Function to update paginated streams.
|
|
135
|
+
* @property {Function} updateDoPaginate - Function to update pagination status.
|
|
136
|
+
* @property {Function} updatePrevDoPaginate - Function to update previous pagination status.
|
|
137
|
+
* @property {Function} updateCurrentUserPage - Function to update current user page.
|
|
138
|
+
* @property {Function} updateNumberPages - Function to update number of pages.
|
|
139
|
+
* @property {Function} updateMainRoomsLength - Function to update main rooms length.
|
|
140
|
+
* @property {Function} updateMemberRoom - Function to update member room.
|
|
141
|
+
* @property {Function} mixStreams - Function to mix streams.
|
|
142
|
+
* @property {Function} dispStreams - Function to display streams.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* const options = {
|
|
146
|
+
* screenChanged: false,
|
|
147
|
+
* parameters: {
|
|
148
|
+
* getUpdatedAllParams: () => updatedParameters,
|
|
149
|
+
* allVideoStreams: allStreams,
|
|
150
|
+
* p_activeNames: activeNames,
|
|
151
|
+
* activeNames: activeNames,
|
|
152
|
+
* dispActiveNames: displayedActiveNames,
|
|
153
|
+
* shareScreenStarted: false,
|
|
154
|
+
* shared: false,
|
|
155
|
+
* newLimitedStreams: limitedStreams,
|
|
156
|
+
* non_alVideoStreams: nonAlStreams,
|
|
157
|
+
* ref_participants: referenceParticipants,
|
|
158
|
+
* participants: participants,
|
|
159
|
+
* eventType: "conference",
|
|
160
|
+
* islevel: "2",
|
|
161
|
+
* member: "John Doe",
|
|
162
|
+
* sortAudioLoudness: true,
|
|
163
|
+
* audioDecibels: audioLevels,
|
|
164
|
+
* mixed_alVideoStreams: mixedStreams,
|
|
165
|
+
* non_alVideoStreams_muted: mutedNonAlStreams,
|
|
166
|
+
* remoteProducerId: "12345",
|
|
167
|
+
* localStreamVideo: localStream,
|
|
168
|
+
* oldAllStreams: oldStreams,
|
|
169
|
+
* screenPageLimit: 10,
|
|
170
|
+
* meetingDisplayType: "video",
|
|
171
|
+
* meetingVideoOptimized: true,
|
|
172
|
+
* recordingVideoOptimized: false,
|
|
173
|
+
* recordingDisplayType: "video",
|
|
174
|
+
* paginatedStreams: paginatedStreams,
|
|
175
|
+
* itemPageLimit: 10,
|
|
176
|
+
* doPaginate: true,
|
|
177
|
+
* prevDoPaginate: false,
|
|
178
|
+
* currentUserPage: 1,
|
|
179
|
+
* breakoutRooms: breakoutRooms,
|
|
180
|
+
* hostNewRoom: 0,
|
|
181
|
+
* breakOutRoomStarted: false,
|
|
182
|
+
* breakOutRoomEnded: false,
|
|
183
|
+
* virtualStream: virtualStream,
|
|
184
|
+
* mainRoomsLength: 2,
|
|
185
|
+
* memberRoom: 0,
|
|
186
|
+
* updateP_activeNames: (names) => updateActiveNames(names),
|
|
187
|
+
* updateActiveNames: (names) => updateActiveNames(names),
|
|
188
|
+
* updateDispActiveNames: (names) => updateDispActiveNames(names),
|
|
189
|
+
* updateNewLimitedStreams: (streams) => updateNewLimitedStreams(streams),
|
|
190
|
+
* updateNon_alVideoStreams: (participants) => updateNon_alVideoStreams(participants),
|
|
191
|
+
* updateRef_participants: (participants) => updateRef_participants(participants),
|
|
192
|
+
* updateSortAudioLoudness: (sort) => updateSortAudioLoudness(sort),
|
|
193
|
+
* updateMixed_alVideoStreams: (streams) => updateMixed_alVideoStreams(streams),
|
|
194
|
+
* updateNon_alVideoStreams_muted: (participants) => updateNon_alVideoStreams_muted(participants),
|
|
195
|
+
* updatePaginatedStreams: (streams) => updatePaginatedStreams(streams),
|
|
196
|
+
* updateDoPaginate: (paginate) => updateDoPaginate(paginate),
|
|
197
|
+
* updatePrevDoPaginate: (paginate) => updatePrevDoPaginate(paginate),
|
|
198
|
+
* updateCurrentUserPage: (page) => updateCurrentUserPage(page),
|
|
199
|
+
* updateNumberPages: (pages) => updateNumberPages(pages),
|
|
200
|
+
* updateMainRoomsLength: (length) => updateMainRoomsLength(length),
|
|
201
|
+
* updateMemberRoom: (room) => updateMemberRoom(room),
|
|
202
|
+
* mixStreams: mixStreams,
|
|
203
|
+
* dispStreams: dispStreams,
|
|
204
|
+
* },
|
|
205
|
+
* };
|
|
206
|
+
*
|
|
207
|
+
* changeVids(options)
|
|
208
|
+
* .then(() => {
|
|
209
|
+
* console.log('Video streams changed successfully');
|
|
210
|
+
* });
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
export const changeVids = async ({ screenChanged = false, parameters }: ChangeVidsOptions): Promise<void> => {
|
|
214
|
+
let { getUpdatedAllParams } = parameters;
|
|
215
|
+
parameters = getUpdatedAllParams();
|
|
216
|
+
|
|
217
|
+
let {
|
|
218
|
+
allVideoStreams,
|
|
219
|
+
p_activeNames,
|
|
220
|
+
activeNames,
|
|
221
|
+
dispActiveNames,
|
|
222
|
+
shareScreenStarted,
|
|
223
|
+
shared,
|
|
224
|
+
newLimitedStreams,
|
|
225
|
+
non_alVideoStreams,
|
|
226
|
+
ref_participants,
|
|
227
|
+
participants,
|
|
228
|
+
eventType,
|
|
229
|
+
islevel,
|
|
230
|
+
member,
|
|
231
|
+
sortAudioLoudness,
|
|
232
|
+
audioDecibels,
|
|
233
|
+
mixed_alVideoStreams,
|
|
234
|
+
non_alVideoStreams_muted,
|
|
235
|
+
remoteProducerId,
|
|
236
|
+
localStreamVideo,
|
|
237
|
+
oldAllStreams,
|
|
238
|
+
screenPageLimit,
|
|
239
|
+
meetingDisplayType,
|
|
240
|
+
meetingVideoOptimized,
|
|
241
|
+
recordingVideoOptimized,
|
|
242
|
+
recordingDisplayType,
|
|
243
|
+
paginatedStreams,
|
|
244
|
+
itemPageLimit,
|
|
245
|
+
doPaginate,
|
|
246
|
+
prevDoPaginate,
|
|
247
|
+
currentUserPage,
|
|
248
|
+
breakoutRooms,
|
|
249
|
+
hostNewRoom,
|
|
250
|
+
breakOutRoomStarted,
|
|
251
|
+
breakOutRoomEnded,
|
|
252
|
+
virtualStream,
|
|
253
|
+
mainRoomsLength,
|
|
254
|
+
memberRoom,
|
|
255
|
+
updateP_activeNames,
|
|
256
|
+
updateActiveNames,
|
|
257
|
+
updateDispActiveNames,
|
|
258
|
+
updateNewLimitedStreams,
|
|
259
|
+
updateNon_alVideoStreams,
|
|
260
|
+
updateRef_participants,
|
|
261
|
+
updateSortAudioLoudness,
|
|
262
|
+
updateMixed_alVideoStreams,
|
|
263
|
+
updateNon_alVideoStreams_muted,
|
|
264
|
+
updatePaginatedStreams,
|
|
265
|
+
updateDoPaginate,
|
|
266
|
+
updatePrevDoPaginate,
|
|
267
|
+
updateCurrentUserPage,
|
|
268
|
+
updateNumberPages,
|
|
269
|
+
updateMainRoomsLength,
|
|
270
|
+
updateMemberRoom,
|
|
271
|
+
mixStreams,
|
|
272
|
+
dispStreams,
|
|
273
|
+
} = parameters;
|
|
274
|
+
|
|
275
|
+
try {
|
|
276
|
+
let alVideoStreams = [...allVideoStreams];
|
|
277
|
+
p_activeNames = [...activeNames];
|
|
278
|
+
|
|
279
|
+
let streame;
|
|
280
|
+
|
|
281
|
+
if (shareScreenStarted || shared) {
|
|
282
|
+
alVideoStreams = [...newLimitedStreams];
|
|
283
|
+
activeNames = [];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
activeNames = [];
|
|
287
|
+
dispActiveNames = [];
|
|
288
|
+
ref_participants = participants;
|
|
289
|
+
|
|
290
|
+
let temp = alVideoStreams;
|
|
291
|
+
|
|
292
|
+
await Promise.all(
|
|
293
|
+
temp.map(async (stream) => {
|
|
294
|
+
let participant = ref_participants.find(
|
|
295
|
+
(obj) => obj.videoID === stream.producerId
|
|
296
|
+
);
|
|
297
|
+
if (!participant && stream.producerId !== "youyou" && stream.producerId !== "youyouyou") {
|
|
298
|
+
alVideoStreams = alVideoStreams.filter(
|
|
299
|
+
(obj) => obj.producerId !== stream.producerId
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
})
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
if (eventType === "broadcast" || eventType === "chat") {
|
|
306
|
+
sortAudioLoudness = false;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (shareScreenStarted || shared) {
|
|
310
|
+
non_alVideoStreams = [];
|
|
311
|
+
non_alVideoStreams_muted = [];
|
|
312
|
+
mixed_alVideoStreams = [];
|
|
313
|
+
} else {
|
|
314
|
+
if (alVideoStreams.length > screenPageLimit) {
|
|
315
|
+
alVideoStreams = alVideoStreams.filter(
|
|
316
|
+
(obj) => obj.producerId !== "youyou" && obj.producerId !== "youyouyou"
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
ref_participants = ref_participants.sort((a, b) => (a.muted ?? false) > (b.muted ?? false) ? 1 : -1
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
let temp: (Stream | Participant)[] = [];
|
|
323
|
+
await Promise.all(
|
|
324
|
+
ref_participants.map((participant) => {
|
|
325
|
+
let stream = alVideoStreams.find(
|
|
326
|
+
(obj) => obj.producerId === participant.videoID
|
|
327
|
+
);
|
|
328
|
+
if (stream) {
|
|
329
|
+
temp.push(stream);
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
alVideoStreams = temp;
|
|
335
|
+
|
|
336
|
+
let youyou = allVideoStreams.find(
|
|
337
|
+
(obj) => obj.producerId === "youyou"
|
|
338
|
+
);
|
|
339
|
+
if (!youyou) {
|
|
340
|
+
let youyouyou = allVideoStreams.find(
|
|
341
|
+
(obj) => obj.producerId === "youyouyou"
|
|
342
|
+
);
|
|
343
|
+
alVideoStreams.unshift(youyouyou!);
|
|
344
|
+
} else {
|
|
345
|
+
alVideoStreams.unshift(youyou!);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const admin = participants.filter(
|
|
350
|
+
(participant) => participant.islevel === "2"
|
|
351
|
+
);
|
|
352
|
+
let adminName = "";
|
|
353
|
+
if (admin.length > 0) {
|
|
354
|
+
adminName = admin[0].name || "";
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
non_alVideoStreams = [];
|
|
358
|
+
|
|
359
|
+
await Promise.all(
|
|
360
|
+
ref_participants.map(async (participant) => {
|
|
361
|
+
let stream = alVideoStreams.find(
|
|
362
|
+
(obj) => obj.producerId === participant.videoID
|
|
363
|
+
);
|
|
364
|
+
if (eventType !== "chat" && eventType !== "conference") {
|
|
365
|
+
if (!stream && participant.name !== member && !participant.muted && participant.name !== adminName) {
|
|
366
|
+
non_alVideoStreams.push(participant);
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
if (!stream && participant.name !== member && !participant.muted) {
|
|
370
|
+
non_alVideoStreams.push(participant);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
if (sortAudioLoudness) {
|
|
377
|
+
non_alVideoStreams.sort((a, b) => {
|
|
378
|
+
const avgLoudnessA =
|
|
379
|
+
audioDecibels.find((obj) => obj.name === a.name)?.averageLoudness || 127;
|
|
380
|
+
const avgLoudnessB =
|
|
381
|
+
audioDecibels.find((obj) => obj.name === b.name)?.averageLoudness || 127;
|
|
382
|
+
return avgLoudnessB - avgLoudnessA;
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
if (
|
|
386
|
+
!(meetingDisplayType === "video" && meetingVideoOptimized) ||
|
|
387
|
+
!(recordingVideoOptimized && recordingDisplayType === "video")
|
|
388
|
+
) {
|
|
389
|
+
mixed_alVideoStreams = await mixStreams({
|
|
390
|
+
alVideoStreams,
|
|
391
|
+
non_alVideoStreams,
|
|
392
|
+
ref_participants
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
non_alVideoStreams_muted = [];
|
|
398
|
+
await Promise.all(
|
|
399
|
+
ref_participants.map(async (participant) => {
|
|
400
|
+
let stream = alVideoStreams.find(
|
|
401
|
+
(obj) => obj.producerId === participant.videoID
|
|
402
|
+
);
|
|
403
|
+
if (eventType !== "chat" && eventType !== "conference") {
|
|
404
|
+
if (!stream && participant.name !== member && participant.muted && participant.name !== adminName) {
|
|
405
|
+
non_alVideoStreams_muted.push(participant);
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
if (!stream && participant.name !== member && participant.muted) {
|
|
409
|
+
non_alVideoStreams_muted.push(participant);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (eventType === "conference" && islevel !== "2") {
|
|
417
|
+
let host = participants.find((obj) => obj.islevel === "2");
|
|
418
|
+
if (host) {
|
|
419
|
+
remoteProducerId = host.videoID!;
|
|
420
|
+
if (islevel === "2") {
|
|
421
|
+
host.stream = virtualStream || localStreamVideo;
|
|
422
|
+
} else {
|
|
423
|
+
let hostVideo = alVideoStreams.find(
|
|
424
|
+
(obj) => obj.producerId === remoteProducerId
|
|
425
|
+
);
|
|
426
|
+
if (!hostVideo) {
|
|
427
|
+
streame = oldAllStreams.find(
|
|
428
|
+
(streame) => streame.producerId === remoteProducerId
|
|
429
|
+
);
|
|
430
|
+
if (streame) {
|
|
431
|
+
alVideoStreams = alVideoStreams.filter(
|
|
432
|
+
(obj) => obj.producerId !== host.videoID
|
|
433
|
+
);
|
|
434
|
+
non_alVideoStreams = non_alVideoStreams.filter(
|
|
435
|
+
(obj) => obj.name !== host.name
|
|
436
|
+
);
|
|
437
|
+
non_alVideoStreams_muted = non_alVideoStreams_muted.filter(
|
|
438
|
+
(obj) => obj.name !== host.name
|
|
439
|
+
);
|
|
440
|
+
if (sortAudioLoudness) {
|
|
441
|
+
mixed_alVideoStreams = mixed_alVideoStreams.filter(
|
|
442
|
+
(obj) => obj.name !== host.name
|
|
443
|
+
);
|
|
444
|
+
non_alVideoStreams_muted = non_alVideoStreams_muted.filter(
|
|
445
|
+
(obj) => obj.name !== host.name
|
|
446
|
+
);
|
|
447
|
+
if (meetingDisplayType == "video" && meetingVideoOptimized) {
|
|
448
|
+
alVideoStreams.unshift(streame);
|
|
449
|
+
} else {
|
|
450
|
+
mixed_alVideoStreams.unshift(streame);
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
alVideoStreams.unshift(streame);
|
|
454
|
+
}
|
|
455
|
+
} else {
|
|
456
|
+
await Promise.all(
|
|
457
|
+
ref_participants.map(async (participant) => {
|
|
458
|
+
let stream = alVideoStreams.find(
|
|
459
|
+
(obj) =>
|
|
460
|
+
obj.producerId == participant.videoID &&
|
|
461
|
+
participant.name == host.name
|
|
462
|
+
);
|
|
463
|
+
if (stream) {
|
|
464
|
+
if (sortAudioLoudness) {
|
|
465
|
+
mixed_alVideoStreams = mixed_alVideoStreams.filter(
|
|
466
|
+
(obj) => obj.name !== host.name
|
|
467
|
+
);
|
|
468
|
+
non_alVideoStreams_muted =
|
|
469
|
+
non_alVideoStreams_muted.filter(
|
|
470
|
+
(obj) => obj.name !== host.name
|
|
471
|
+
);
|
|
472
|
+
mixed_alVideoStreams.unshift(participant);
|
|
473
|
+
} else {
|
|
474
|
+
non_alVideoStreams = non_alVideoStreams.filter(
|
|
475
|
+
(obj) => obj.name !== host.name
|
|
476
|
+
);
|
|
477
|
+
non_alVideoStreams.unshift(participant);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
})
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
let allStreamsPaged: (Stream | Participant)[] = [];
|
|
490
|
+
if (sortAudioLoudness) {
|
|
491
|
+
if (meetingDisplayType === "video") {
|
|
492
|
+
if (meetingVideoOptimized) {
|
|
493
|
+
allStreamsPaged = [...alVideoStreams];
|
|
494
|
+
} else {
|
|
495
|
+
allStreamsPaged = [...mixed_alVideoStreams];
|
|
496
|
+
}
|
|
497
|
+
} else if (meetingDisplayType === "media") {
|
|
498
|
+
allStreamsPaged = [...mixed_alVideoStreams];
|
|
499
|
+
} else if (meetingDisplayType === "all") {
|
|
500
|
+
allStreamsPaged = [...mixed_alVideoStreams, ...non_alVideoStreams_muted];
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
if (meetingDisplayType === "video") {
|
|
504
|
+
allStreamsPaged = [...alVideoStreams];
|
|
505
|
+
} else if (meetingDisplayType === "media") {
|
|
506
|
+
allStreamsPaged = [...alVideoStreams, ...non_alVideoStreams];
|
|
507
|
+
} else if (meetingDisplayType === "all") {
|
|
508
|
+
allStreamsPaged = [
|
|
509
|
+
...alVideoStreams,
|
|
510
|
+
...non_alVideoStreams,
|
|
511
|
+
...non_alVideoStreams_muted,
|
|
512
|
+
];
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
paginatedStreams = [];
|
|
517
|
+
let limit = itemPageLimit;
|
|
518
|
+
|
|
519
|
+
if (shareScreenStarted || shared) {
|
|
520
|
+
limit = screenPageLimit;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
let firstPage: (Stream | Participant)[] = [];
|
|
524
|
+
let page: (Stream | Participant)[] = [];
|
|
525
|
+
let limit_ = limit + 1;
|
|
526
|
+
|
|
527
|
+
if (eventType === "conference" && !shared && !shareScreenStarted) {
|
|
528
|
+
limit_ = limit_ - 1;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Create pagination
|
|
532
|
+
let memberInRoom = false;
|
|
533
|
+
let filterHost = false;
|
|
534
|
+
if (breakOutRoomStarted && !breakOutRoomEnded) {
|
|
535
|
+
let tempBreakoutRooms = JSON.parse(JSON.stringify(breakoutRooms));
|
|
536
|
+
let host = participants.find((obj) => obj.islevel == "2");
|
|
537
|
+
for (let room of tempBreakoutRooms) {
|
|
538
|
+
try {
|
|
539
|
+
let currentStreams: (Stream | Participant)[] = [];
|
|
540
|
+
const roomIndex = tempBreakoutRooms.indexOf(room);
|
|
541
|
+
if (hostNewRoom != -1 && roomIndex == hostNewRoom) {
|
|
542
|
+
if (host) {
|
|
543
|
+
if (!room.map((obj: any) => obj.name).includes(host.name)) {
|
|
544
|
+
room = [...room, { name: host.name, breakRoom: roomIndex }];
|
|
545
|
+
filterHost = true;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
for (let participant of room) {
|
|
550
|
+
if (participant.name == member && !memberInRoom) {
|
|
551
|
+
memberInRoom = true;
|
|
552
|
+
memberRoom = participant.breakRoom;
|
|
553
|
+
updateMemberRoom(memberRoom);
|
|
554
|
+
}
|
|
555
|
+
let streams = allStreamsPaged.filter((stream) => {
|
|
556
|
+
if ((Object.prototype.hasOwnProperty.call(stream, "producerId") &&
|
|
557
|
+
stream.producerId != null &&
|
|
558
|
+
stream.producerId !== "") ||
|
|
559
|
+
(Object.prototype.hasOwnProperty.call(stream, "audioID") &&
|
|
560
|
+
stream['audioID'] != null &&
|
|
561
|
+
stream['audioID'] !== "")) {
|
|
562
|
+
let producerId = stream.producerId || stream['audioID'];
|
|
563
|
+
let matchingParticipant = ref_participants.find(
|
|
564
|
+
(obj) => obj['audioID'] === producerId ||
|
|
565
|
+
obj.videoID === producerId ||
|
|
566
|
+
((producerId == "youyou" || producerId == "youyouyou") &&
|
|
567
|
+
member == participant.name)
|
|
568
|
+
);
|
|
569
|
+
return (
|
|
570
|
+
(matchingParticipant &&
|
|
571
|
+
matchingParticipant.name === participant.name) ||
|
|
572
|
+
(participant.name == member &&
|
|
573
|
+
(producerId == "youyou" || producerId == "youyouyou"))
|
|
574
|
+
);
|
|
575
|
+
} else {
|
|
576
|
+
return (
|
|
577
|
+
Object.prototype.hasOwnProperty.call(stream, "name") &&
|
|
578
|
+
stream.name == participant.name
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
for (let stream of streams) {
|
|
583
|
+
if (currentStreams.length < limit_) {
|
|
584
|
+
currentStreams.push(stream);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
paginatedStreams.push(currentStreams);
|
|
589
|
+
} catch {
|
|
590
|
+
// handle error
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
let remainingStreams = allStreamsPaged.filter((stream) => {
|
|
595
|
+
if ((Object.prototype.hasOwnProperty.call(stream, "producerId") &&
|
|
596
|
+
stream.producerId != null &&
|
|
597
|
+
stream.producerId !== "") ||
|
|
598
|
+
(Object.prototype.hasOwnProperty.call(stream, "audioID") &&
|
|
599
|
+
stream['audioID'] != null &&
|
|
600
|
+
stream['audioID'] !== "")) {
|
|
601
|
+
let producerId = stream.producerId || stream['audioID'];
|
|
602
|
+
let matchingParticipant = ref_participants.find(
|
|
603
|
+
(obj) => obj['audioID'] === producerId ||
|
|
604
|
+
obj.videoID === producerId ||
|
|
605
|
+
((producerId == "youyou" || producerId == "youyouyou") &&
|
|
606
|
+
member == obj.name)
|
|
607
|
+
);
|
|
608
|
+
return (
|
|
609
|
+
matchingParticipant &&
|
|
610
|
+
!breakoutRooms!
|
|
611
|
+
.flat()
|
|
612
|
+
.map((obj) => obj.name)
|
|
613
|
+
.includes(matchingParticipant.name) &&
|
|
614
|
+
(!filterHost || matchingParticipant.name != host!.name)
|
|
615
|
+
);
|
|
616
|
+
} else {
|
|
617
|
+
return (
|
|
618
|
+
!breakoutRooms!
|
|
619
|
+
.flat()
|
|
620
|
+
.map((obj) => obj.name)
|
|
621
|
+
.includes(stream.name ?? '') &&
|
|
622
|
+
(!filterHost || stream.name != host!.name)
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
if (memberInRoom) {
|
|
628
|
+
let memberStream = allStreamsPaged.find((stream) => {
|
|
629
|
+
if (Object.prototype.hasOwnProperty.call(stream, "producerId") &&
|
|
630
|
+
stream.producerId != null &&
|
|
631
|
+
stream.producerId !== "") {
|
|
632
|
+
return (
|
|
633
|
+
stream.producerId == "youyou" || stream.producerId == "youyouyou"
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
return false; // Add a return statement here
|
|
637
|
+
});
|
|
638
|
+
if (memberStream && !remainingStreams.includes(memberStream)) {
|
|
639
|
+
remainingStreams.unshift(memberStream);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
let remainingPaginatedStreams: (Stream | Participant)[][] = [];
|
|
643
|
+
|
|
644
|
+
if (remainingStreams.length > 0) {
|
|
645
|
+
firstPage = remainingStreams.slice(0, limit_);
|
|
646
|
+
remainingPaginatedStreams.push(firstPage);
|
|
647
|
+
for (let i = limit_; i < remainingStreams.length; i += limit) {
|
|
648
|
+
page = remainingStreams.slice(i, i + limit);
|
|
649
|
+
remainingPaginatedStreams.push(page);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
mainRoomsLength = remainingPaginatedStreams.length;
|
|
654
|
+
updateMainRoomsLength(mainRoomsLength);
|
|
655
|
+
// Add the remaining streams to the beginning of the paginatedStreams
|
|
656
|
+
for (let i = remainingPaginatedStreams.length - 1; i >= 0; i--) {
|
|
657
|
+
paginatedStreams.unshift(remainingPaginatedStreams[i]);
|
|
658
|
+
}
|
|
659
|
+
} else {
|
|
660
|
+
firstPage = allStreamsPaged.slice(0, limit_);
|
|
661
|
+
paginatedStreams.push(firstPage);
|
|
662
|
+
|
|
663
|
+
for (let i = limit_; i < allStreamsPaged.length; i += limit) {
|
|
664
|
+
page = allStreamsPaged.slice(i, i + limit);
|
|
665
|
+
paginatedStreams.push(page);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// State updates
|
|
670
|
+
updateP_activeNames(p_activeNames);
|
|
671
|
+
updateActiveNames(activeNames);
|
|
672
|
+
updateDispActiveNames(dispActiveNames);
|
|
673
|
+
updateNewLimitedStreams(newLimitedStreams);
|
|
674
|
+
updateNon_alVideoStreams(non_alVideoStreams);
|
|
675
|
+
updateRef_participants(ref_participants);
|
|
676
|
+
updateSortAudioLoudness(sortAudioLoudness);
|
|
677
|
+
updateMixed_alVideoStreams(mixed_alVideoStreams);
|
|
678
|
+
updateNon_alVideoStreams_muted(non_alVideoStreams_muted);
|
|
679
|
+
updatePaginatedStreams(paginatedStreams);
|
|
680
|
+
|
|
681
|
+
prevDoPaginate = doPaginate;
|
|
682
|
+
doPaginate = false;
|
|
683
|
+
updatePrevDoPaginate(prevDoPaginate);
|
|
684
|
+
updateDoPaginate(doPaginate);
|
|
685
|
+
|
|
686
|
+
let isActive = false;
|
|
687
|
+
|
|
688
|
+
if (paginatedStreams.length > 1) {
|
|
689
|
+
if (!shareScreenStarted && !shared) {
|
|
690
|
+
doPaginate = true;
|
|
691
|
+
}
|
|
692
|
+
updateDoPaginate(doPaginate);
|
|
693
|
+
|
|
694
|
+
if (currentUserPage > paginatedStreams.length - 1) {
|
|
695
|
+
if (breakOutRoomStarted && !breakOutRoomEnded) {
|
|
696
|
+
currentUserPage = 0;
|
|
697
|
+
} else {
|
|
698
|
+
currentUserPage = paginatedStreams.length - 1;
|
|
699
|
+
}
|
|
700
|
+
} else if (currentUserPage == 0) {
|
|
701
|
+
isActive = true;
|
|
702
|
+
}
|
|
703
|
+
updateCurrentUserPage(currentUserPage);
|
|
704
|
+
updateNumberPages(paginatedStreams.length - 1);
|
|
705
|
+
|
|
706
|
+
if (screenChanged) {
|
|
707
|
+
await dispStreams({
|
|
708
|
+
lStreams: paginatedStreams[0],
|
|
709
|
+
ind: 0,
|
|
710
|
+
parameters,
|
|
711
|
+
});
|
|
712
|
+
} else {
|
|
713
|
+
await dispStreams({
|
|
714
|
+
lStreams: paginatedStreams[0],
|
|
715
|
+
ind: 0,
|
|
716
|
+
auto: true,
|
|
717
|
+
parameters,
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
if (!isActive) {
|
|
722
|
+
const currentPageBreak = currentUserPage - mainRoomsLength;
|
|
723
|
+
await dispStreams({
|
|
724
|
+
lStreams: paginatedStreams[currentUserPage],
|
|
725
|
+
ind: currentUserPage,
|
|
726
|
+
parameters,
|
|
727
|
+
breakRoom: currentPageBreak,
|
|
728
|
+
inBreakRoom: currentPageBreak >= 0,
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
} else {
|
|
732
|
+
currentUserPage = 0;
|
|
733
|
+
updateCurrentUserPage(currentUserPage);
|
|
734
|
+
|
|
735
|
+
if (screenChanged) {
|
|
736
|
+
await dispStreams({
|
|
737
|
+
lStreams: paginatedStreams[0],
|
|
738
|
+
ind: 0,
|
|
739
|
+
parameters,
|
|
740
|
+
});
|
|
741
|
+
} else {
|
|
742
|
+
await dispStreams({
|
|
743
|
+
lStreams: paginatedStreams[0],
|
|
744
|
+
ind: 0,
|
|
745
|
+
auto: true,
|
|
746
|
+
parameters,
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
} catch (error) {
|
|
751
|
+
console.log("changeVids error", error);
|
|
752
|
+
}
|
|
753
|
+
};
|