@azure/communication-react 1.5.1-alpha-202303040013 → 1.5.1-alpha-202303070015
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +60 -1
- package/dist/dist-cjs/communication-react/index.js +407 -413
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +4 -0
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +35 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.d.ts +1 -1
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js +1 -1
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Logger.d.ts +16 -29
- package/dist/dist-esm/calling-stateful-client/src/Logger.js +16 -29
- package/dist/dist-esm/calling-stateful-client/src/Logger.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js +132 -385
- package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/StreamUtilsLogging.d.ts +17 -0
- package/dist/dist-esm/calling-stateful-client/src/StreamUtilsLogging.js +198 -0
- package/dist/dist-esm/calling-stateful-client/src/StreamUtilsLogging.js.map +1 -0
- package/dist/dist-esm/communication-react/src/index.d.ts +1 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VerticalGallery.d.ts +15 -0
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js +18 -4
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +5 -2
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +5 -2
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.d.ts +3 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js +11 -5
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +3 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +4 -0
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +5 -1
- package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +5 -0
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +12 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/package.json +8 -8
@@ -11,250 +11,129 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
};
|
12
12
|
import { LocalVideoStream, VideoStreamRenderer } from '@azure/communication-calling';
|
13
13
|
import { convertSdkLocalStreamToDeclarativeLocalStream, convertSdkRemoteStreamToDeclarativeRemoteStream, convertFromSDKToDeclarativeVideoStreamRendererView } from './Converter';
|
14
|
-
import { toFlatCommunicationIdentifier
|
15
|
-
import {
|
16
|
-
|
14
|
+
import { toFlatCommunicationIdentifier } from "../../acs-ui-common/src";
|
15
|
+
import { EventNames } from './Logger';
|
16
|
+
import { _logStreamEvent } from './StreamUtilsLogging';
|
17
|
+
function createViewVideo(context, internalContext, callId, stream, participantId, options) {
|
17
18
|
return __awaiter(this, void 0, void 0, function* () {
|
18
|
-
//
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
// we can only have 3 types of createView
|
20
|
+
let streamEventType;
|
21
|
+
// we will reuse these for local as well but we need to make sure the remote stream is passed in like before.
|
22
|
+
if (participantId) {
|
23
|
+
streamEventType = 'createViewRemote';
|
24
|
+
}
|
25
|
+
else if (callId) {
|
26
|
+
streamEventType = 'createViewLocal';
|
24
27
|
}
|
25
28
|
else {
|
26
|
-
|
29
|
+
// TODO update for when unparented view.
|
30
|
+
throw new Error('unparented createView not implemented yet here');
|
31
|
+
streamEventType = 'createViewUnparented';
|
27
32
|
}
|
28
|
-
const
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
const streamType = stream === null || stream === void 0 ? void 0 : stream.mediaStreamType;
|
34
|
+
const streamId = stream.id;
|
35
|
+
// we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.
|
36
|
+
const participantKey = streamEventType === 'createViewRemote' && participantId
|
37
|
+
? typeof participantId === 'string'
|
38
|
+
? participantId
|
39
|
+
: toFlatCommunicationIdentifier(participantId)
|
40
|
+
: undefined;
|
41
|
+
const streamLogInfo = { callId, participantKey, streamId, streamType, streamEventType };
|
42
|
+
// make different logging announcement based on whether or not we are starting a local or remote
|
43
|
+
_logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);
|
44
|
+
// if we have a participant Id and a stream get the remote info, else get the local render info from state.
|
45
|
+
const renderInfo = streamEventType === 'createViewRemote' && participantKey
|
46
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)
|
47
|
+
: internalContext.getLocalRenderInfo(callId);
|
36
48
|
if (!renderInfo) {
|
37
|
-
|
38
|
-
name: EventNames.REMOTE_STREAM_NOT_FOUND,
|
39
|
-
level: 'error',
|
40
|
-
message: 'RemoteVideoStream not found in state.',
|
41
|
-
data: streamLogInfo
|
42
|
-
});
|
43
|
-
console.warn('RemoteVideoStream not found in state');
|
49
|
+
_logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);
|
44
50
|
return;
|
45
51
|
}
|
46
52
|
if (renderInfo.status === 'Rendered') {
|
47
|
-
|
48
|
-
name: EventNames.REMOTE_STREAM_ALREADY_RENDERED,
|
49
|
-
level: 'warning',
|
50
|
-
message: 'RemoteVideoStream is already rendered.',
|
51
|
-
data: streamLogInfo
|
52
|
-
});
|
53
|
-
console.warn('RemoteVideoStream is already rendered');
|
53
|
+
_logStreamEvent(EventNames.STREAM_ALREADY_RENDERED, streamLogInfo);
|
54
54
|
return;
|
55
55
|
}
|
56
56
|
if (renderInfo.status === 'Rendering') {
|
57
57
|
// Do not log to console here as this is a very common situation due to UI rerenders while
|
58
58
|
// the video rendering is in progress.
|
59
|
-
|
60
|
-
name: EventNames.REMOTE_STREAM_RENDERING,
|
61
|
-
level: 'warning',
|
62
|
-
message: 'RemoteVideoStream is rendering.',
|
63
|
-
data: streamLogInfo
|
64
|
-
});
|
59
|
+
_logStreamEvent(EventNames.STREAM_RENDERING, streamLogInfo);
|
65
60
|
return;
|
66
61
|
}
|
67
62
|
// "Stopping" only happens if the stream was in "rendering" but `disposeView` was called.
|
68
63
|
// Now that `createView` has been re-called, we can flip the state back to "rendering".
|
69
64
|
if (renderInfo.status === 'Stopping') {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
65
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
66
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
67
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
68
|
+
}
|
69
|
+
else if (streamEventType === 'createViewLocal') {
|
70
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
71
|
+
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
72
|
+
}
|
77
73
|
return;
|
78
74
|
}
|
79
75
|
const renderer = new VideoStreamRenderer(renderInfo.stream);
|
80
|
-
|
76
|
+
streamEventType === 'createViewRemote' && participantKey
|
77
|
+
? internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', undefined)
|
78
|
+
: internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderer);
|
81
79
|
let view;
|
82
80
|
try {
|
83
81
|
view = yield renderer.createView(options);
|
84
82
|
}
|
85
83
|
catch (e) {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
84
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
85
|
+
_logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);
|
86
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);
|
87
|
+
}
|
88
|
+
else if (streamEventType === 'createViewLocal') {
|
89
|
+
_logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);
|
90
|
+
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
91
|
+
}
|
93
92
|
throw e;
|
94
93
|
}
|
95
94
|
// Since render could take some time, we need to check if the stream is still valid and if we received a signal to
|
96
95
|
// stop rendering.
|
97
|
-
const refreshedRenderInfo =
|
96
|
+
const refreshedRenderInfo = streamEventType === 'createViewRemote' && participantKey
|
97
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)
|
98
|
+
: internalContext.getLocalRenderInfo(callId);
|
98
99
|
if (!refreshedRenderInfo) {
|
99
100
|
// RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer
|
100
|
-
// and clean up state.
|
101
|
-
|
102
|
-
name: EventNames.REMOTE_RENDER_INFO_NOT_FOUND,
|
103
|
-
level: 'error',
|
104
|
-
message: 'Cannot find remote render info after create the view.',
|
105
|
-
data: streamLogInfo
|
106
|
-
});
|
101
|
+
// and clean up the state.
|
102
|
+
_logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);
|
107
103
|
renderer.dispose();
|
108
|
-
|
104
|
+
streamEventType === 'createViewRemote' && participantKey
|
105
|
+
? context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined)
|
106
|
+
: context.setLocalVideoStreamRendererView(callId, undefined);
|
109
107
|
return;
|
110
108
|
}
|
111
109
|
if (refreshedRenderInfo.status === 'Stopping') {
|
112
110
|
// Stop render was called on this stream after we had started rendering. We will dispose this view and do not
|
113
111
|
// put the view into the state.
|
114
|
-
|
115
|
-
|
116
|
-
level: 'warning',
|
117
|
-
message: 'Render info status is stopping, dispose renderer.',
|
118
|
-
data: streamLogInfo
|
119
|
-
});
|
112
|
+
streamEventType === 'createViewRemote';
|
113
|
+
_logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);
|
120
114
|
renderer.dispose();
|
121
|
-
|
122
|
-
|
115
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
116
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
117
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
118
|
+
}
|
119
|
+
else if (streamEventType === 'createViewLocal') {
|
120
|
+
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
121
|
+
context.setLocalVideoStreamRendererView(callId, undefined);
|
122
|
+
}
|
123
123
|
return;
|
124
124
|
}
|
125
125
|
// Else the stream still exists and status is not telling us to stop rendering. Complete the render process by
|
126
126
|
// updating the state.
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
level: 'info',
|
132
|
-
message: `Successfully render the remote view.`,
|
133
|
-
data: {
|
134
|
-
streamLogInfo
|
135
|
-
}
|
136
|
-
});
|
137
|
-
return {
|
138
|
-
renderer,
|
139
|
-
view
|
140
|
-
};
|
141
|
-
});
|
142
|
-
}
|
143
|
-
function createViewLocalVideo(context, internalContext, callId, options) {
|
144
|
-
return __awaiter(this, void 0, void 0, function* () {
|
145
|
-
// Render LocalVideoStream that is part of a Call
|
146
|
-
const renderInfo = internalContext.getLocalRenderInfo(callId);
|
147
|
-
const streamType = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.stream.mediaStreamType;
|
148
|
-
const streamLogInfo = { callId, streamType };
|
149
|
-
_logEvent(callingStatefulLogger, {
|
150
|
-
name: EventNames.START_LOCAL_STREAM_RENDERING,
|
151
|
-
level: 'info',
|
152
|
-
message: 'Start creating view for local video.',
|
153
|
-
data: streamLogInfo
|
154
|
-
});
|
155
|
-
if (!renderInfo) {
|
156
|
-
_logEvent(callingStatefulLogger, {
|
157
|
-
name: EventNames.LOCAL_STREAM_NOT_FOUND,
|
158
|
-
level: 'error',
|
159
|
-
message: 'LocalVideoStream not found in state.',
|
160
|
-
data: { callId }
|
161
|
-
});
|
162
|
-
console.warn('LocalVideoStream not found in state');
|
163
|
-
return;
|
164
|
-
}
|
165
|
-
if (renderInfo.status === 'Rendered') {
|
166
|
-
_logEvent(callingStatefulLogger, {
|
167
|
-
name: EventNames.LOCAL_STREAM_ALREADY_RENDERED,
|
168
|
-
level: 'warning',
|
169
|
-
message: 'LocalVideoStream is already rendered.',
|
170
|
-
data: streamLogInfo
|
171
|
-
});
|
172
|
-
console.warn('LocalVideoStream is already rendered');
|
173
|
-
return;
|
174
|
-
}
|
175
|
-
if (renderInfo.status === 'Rendering') {
|
176
|
-
// Do not log to console here as this is a very common situation due to UI rerenders while
|
177
|
-
// the video rendering is in progress.
|
178
|
-
_logEvent(callingStatefulLogger, {
|
179
|
-
name: EventNames.LOCAL_STREAM_RENDERING,
|
180
|
-
level: 'warning',
|
181
|
-
message: 'LocalVideoStream is rendering.',
|
182
|
-
data: streamLogInfo
|
183
|
-
});
|
184
|
-
return;
|
185
|
-
}
|
186
|
-
// "Stopping" only happens if the stream was in "rendering" but `disposeView` was called.
|
187
|
-
// Now that `createView` has been re-called, we can flip the state back to "rendering".
|
188
|
-
if (renderInfo.status === 'Stopping') {
|
189
|
-
_logEvent(callingStatefulLogger, {
|
190
|
-
name: EventNames.LOCAL_STREAM_STOPPING,
|
191
|
-
level: 'warning',
|
192
|
-
message: 'LocalVideoStream was marked as stopping by dispose view. Resetting state to "Rendering".',
|
193
|
-
data: streamLogInfo
|
194
|
-
});
|
195
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
196
|
-
return;
|
197
|
-
}
|
198
|
-
const renderer = new VideoStreamRenderer(renderInfo.stream);
|
199
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderer);
|
200
|
-
let view;
|
201
|
-
try {
|
202
|
-
view = yield renderer.createView(options);
|
203
|
-
}
|
204
|
-
catch (e) {
|
205
|
-
_logEvent(callingStatefulLogger, {
|
206
|
-
name: EventNames.CREATE_LOCAL_STREAM_FAIL,
|
207
|
-
level: 'error',
|
208
|
-
message: 'Failed to create view.',
|
209
|
-
data: {
|
210
|
-
error: e,
|
211
|
-
streamType,
|
212
|
-
callId
|
213
|
-
}
|
214
|
-
});
|
215
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
216
|
-
throw e;
|
217
|
-
}
|
218
|
-
// Since render could take some time, we need to check if the stream is still valid and if we received a signal to
|
219
|
-
// stop rendering.
|
220
|
-
const refreshedRenderInfo = internalContext.getLocalRenderInfo(callId);
|
221
|
-
if (!refreshedRenderInfo) {
|
222
|
-
// RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer
|
223
|
-
// and clean up the state.
|
224
|
-
_logEvent(callingStatefulLogger, {
|
225
|
-
name: EventNames.LOCAL_RENDER_INFO_NOT_FOUND,
|
226
|
-
level: 'error',
|
227
|
-
message: 'Cannot find local render info after create the view. ',
|
228
|
-
data: streamLogInfo
|
229
|
-
});
|
230
|
-
renderer.dispose();
|
231
|
-
context.setLocalVideoStreamRendererView(callId, undefined);
|
232
|
-
return;
|
127
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
128
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
129
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
130
|
+
_logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);
|
233
131
|
}
|
234
|
-
if (
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
name: EventNames.LOCAL_CREATED_STREAM_STOPPING,
|
239
|
-
level: 'warning',
|
240
|
-
message: 'Render info status is stopping, dispose renderer.',
|
241
|
-
data: streamLogInfo
|
242
|
-
});
|
243
|
-
renderer.dispose();
|
244
|
-
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
245
|
-
context.setLocalVideoStreamRendererView(callId, undefined);
|
246
|
-
return;
|
132
|
+
else if (streamEventType === 'createViewLocal') {
|
133
|
+
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
134
|
+
context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
135
|
+
_logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);
|
247
136
|
}
|
248
|
-
// Else The stream still exists and status is not telling us to stop rendering. Complete the render process by
|
249
|
-
// updating the state.
|
250
|
-
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
251
|
-
context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
252
|
-
_logEvent(callingStatefulLogger, {
|
253
|
-
name: EventNames.LOCAL_VIEW_RENDER_SUCCEED,
|
254
|
-
level: 'info',
|
255
|
-
message: `Successfully render the local view.`,
|
256
|
-
data: streamLogInfo
|
257
|
-
});
|
258
137
|
return {
|
259
138
|
renderer,
|
260
139
|
view
|
@@ -321,213 +200,101 @@ function createViewUnparentedVideo(context, internalContext, stream, options) {
|
|
321
200
|
};
|
322
201
|
});
|
323
202
|
}
|
324
|
-
function
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
if (
|
329
|
-
|
203
|
+
function disposeViewVideo(context, internalContext, callId, stream, participantId) {
|
204
|
+
// we can only have 3 types of createView
|
205
|
+
let streamEventType;
|
206
|
+
// we will reuse these for local as well but we need to make sure the remote stream is passed in like before.
|
207
|
+
if (participantId) {
|
208
|
+
streamEventType = 'disposeViewRemote';
|
209
|
+
}
|
210
|
+
else if (callId) {
|
211
|
+
streamEventType = 'disposeViewLocal';
|
330
212
|
}
|
331
213
|
else {
|
332
|
-
|
214
|
+
// TODO update for when unparented view.
|
215
|
+
streamEventType = 'disposeViewUnparented';
|
333
216
|
}
|
217
|
+
const streamType = stream.mediaStreamType;
|
218
|
+
const streamId = stream.id;
|
219
|
+
// we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.
|
220
|
+
const participantKey = streamEventType === 'disposeViewRemote' && participantId
|
221
|
+
? typeof participantId === 'string'
|
222
|
+
? participantId
|
223
|
+
: toFlatCommunicationIdentifier(participantId)
|
224
|
+
: undefined;
|
334
225
|
const streamLogInfo = { callId, participantKey, streamId, streamType };
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
message: 'Start disposing remote stream.',
|
339
|
-
data: streamLogInfo
|
340
|
-
});
|
341
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
342
|
-
const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);
|
343
|
-
if (!renderInfo) {
|
344
|
-
_logEvent(callingStatefulLogger, {
|
345
|
-
name: EventNames.REMOTE_DISPOSE_INFO_NOT_FOUND,
|
346
|
-
level: 'error',
|
347
|
-
message: 'Cannot find render info when disposing remote stream.',
|
348
|
-
data: streamLogInfo
|
349
|
-
});
|
350
|
-
return;
|
351
|
-
}
|
352
|
-
// Nothing to dispose of or clean up -- we can safely exit early here.
|
353
|
-
if (renderInfo.status === 'NotRendered') {
|
354
|
-
_logEvent(callingStatefulLogger, {
|
355
|
-
name: EventNames.REMOTE_STREAM_ALREADY_DISPOSED,
|
356
|
-
level: 'info',
|
357
|
-
message: 'RemoteVideoStream is already disposed.',
|
358
|
-
data: streamLogInfo
|
359
|
-
});
|
360
|
-
return;
|
226
|
+
_logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);
|
227
|
+
if (streamEventType === 'disposeViewRemote' && participantKey) {
|
228
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
361
229
|
}
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
if (renderInfo.status === 'Stopping') {
|
366
|
-
_logEvent(callingStatefulLogger, {
|
367
|
-
name: EventNames.REMOTE_STREAM_STOPPING,
|
368
|
-
level: 'info',
|
369
|
-
message: 'Remote stream is already stopping.',
|
370
|
-
data: streamLogInfo
|
371
|
-
});
|
372
|
-
return;
|
373
|
-
}
|
374
|
-
// If the stream is in the middle of being rendered (i.e. has state "Rendering"), we need the status as
|
375
|
-
// "stopping" without performing any cleanup. This will tell the `createView` method that it should stop
|
376
|
-
// rendering and clean up the state once the view has finished being created.
|
377
|
-
if (renderInfo.status === 'Rendering') {
|
378
|
-
_logEvent(callingStatefulLogger, {
|
379
|
-
name: EventNames.REMOTE_STREAM_STOPPING,
|
380
|
-
level: 'info',
|
381
|
-
message: 'Remote stream is still rendering. Changing status to stopping.',
|
382
|
-
data: streamLogInfo
|
383
|
-
});
|
384
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Stopping', undefined);
|
385
|
-
return;
|
386
|
-
}
|
387
|
-
// Else the state must be in the "Rendered" state, so we can dispose the renderer and clean up the state.
|
388
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);
|
389
|
-
if (renderInfo.renderer) {
|
390
|
-
_logEvent(callingStatefulLogger, {
|
391
|
-
name: EventNames.DISPOSING_REMOTE_RENDERER,
|
392
|
-
level: 'info',
|
393
|
-
message: 'Disposing remote view renderer.',
|
394
|
-
data: streamLogInfo
|
395
|
-
});
|
396
|
-
renderInfo.renderer.dispose();
|
397
|
-
}
|
398
|
-
else {
|
399
|
-
_logEvent(callingStatefulLogger, {
|
400
|
-
name: EventNames.REMOTE_RENDERER_NOT_FOUND,
|
401
|
-
level: 'error',
|
402
|
-
message: 'Cannot find remote view renderer.',
|
403
|
-
data: streamLogInfo
|
404
|
-
});
|
405
|
-
}
|
406
|
-
}
|
407
|
-
function disposeViewLocalVideo(context, internalContext, callId) {
|
408
|
-
const renderInfo = internalContext.getLocalRenderInfo(callId);
|
409
|
-
const streamType = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.stream.mediaStreamType;
|
410
|
-
const streamLogInfo = { callId, streamType };
|
411
|
-
_logEvent(callingStatefulLogger, {
|
412
|
-
name: EventNames.START_DISPOSE_LOCAL_STREAM,
|
413
|
-
level: 'info',
|
414
|
-
message: 'Start disposing local stream.',
|
415
|
-
data: streamLogInfo
|
416
|
-
});
|
230
|
+
const renderInfo = streamEventType === 'disposeViewRemote' && participantKey
|
231
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)
|
232
|
+
: internalContext.getLocalRenderInfo(callId);
|
417
233
|
if (!renderInfo) {
|
418
|
-
|
419
|
-
name: EventNames.LOCAL_DISPOSE_INFO_NOT_FOUND,
|
420
|
-
level: 'error',
|
421
|
-
message: 'Cannot find render info when disposing local stream.',
|
422
|
-
data: streamLogInfo
|
423
|
-
});
|
234
|
+
_logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);
|
424
235
|
return;
|
425
236
|
}
|
426
237
|
// Nothing to dispose of or clean up -- we can safely exit early here.
|
427
238
|
if (renderInfo.status === 'NotRendered') {
|
428
|
-
|
429
|
-
name: EventNames.LOCAL_STREAM_ALREADY_DISPOSED,
|
430
|
-
level: 'info',
|
431
|
-
message: 'LocalVideoStream is already disposed.',
|
432
|
-
data: streamLogInfo
|
433
|
-
});
|
239
|
+
_logStreamEvent(EventNames.STREAM_ALREADY_DISPOSED, streamLogInfo);
|
434
240
|
return;
|
435
241
|
}
|
436
242
|
// Status is already marked as "stopping" so we can exit early here. This is because stopping only occurs
|
437
243
|
// when the stream is being created in createView but hasn't been completed being created yet. The createView
|
438
244
|
// method will see the "stopping" status and perform the cleanup
|
439
245
|
if (renderInfo.status === 'Stopping') {
|
440
|
-
|
441
|
-
name: EventNames.LOCAL_STREAM_STOPPING,
|
442
|
-
level: 'info',
|
443
|
-
message: 'Local stream is already stopping.',
|
444
|
-
data: streamLogInfo
|
445
|
-
});
|
246
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
446
247
|
return;
|
447
248
|
}
|
448
249
|
// If the stream is in the middle of being rendered (i.e. has state "Rendering"), we need the status as
|
449
250
|
// "stopping" without performing any cleanup. This will tell the `createView` method that it should stop
|
450
251
|
// rendering and clean up the state once the view has finished being created.
|
451
252
|
if (renderInfo.status === 'Rendering') {
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
data: streamLogInfo
|
457
|
-
});
|
458
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', renderInfo.renderer);
|
253
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
254
|
+
streamEventType === 'disposeViewRemote' && participantKey
|
255
|
+
? internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Stopping', undefined)
|
256
|
+
: internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', renderInfo.renderer);
|
459
257
|
return;
|
460
258
|
}
|
461
259
|
if (renderInfo.renderer) {
|
462
|
-
|
463
|
-
name: EventNames.DISPOSING_LOCAL_RENDERER,
|
464
|
-
level: 'info',
|
465
|
-
message: 'Disposing local view renderer.',
|
466
|
-
data: streamLogInfo
|
467
|
-
});
|
260
|
+
_logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);
|
468
261
|
renderInfo.renderer.dispose();
|
469
|
-
//
|
470
|
-
|
471
|
-
|
472
|
-
|
262
|
+
// Else the state must be in the "Rendered" state, so we can dispose the renderer and clean up the state.
|
263
|
+
if (streamEventType === 'disposeViewRemote' && participantKey) {
|
264
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);
|
265
|
+
}
|
266
|
+
else if (streamEventType === 'disposeViewLocal') {
|
267
|
+
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
268
|
+
context.setLocalVideoStreamRendererView(callId, undefined);
|
269
|
+
}
|
473
270
|
}
|
474
271
|
else {
|
475
|
-
|
476
|
-
name: EventNames.LOCAL_RENDERER_NOT_FOUND,
|
477
|
-
level: 'error',
|
478
|
-
message: 'Cannot find renderer when disposing local stream.',
|
479
|
-
data: streamLogInfo
|
480
|
-
});
|
272
|
+
_logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);
|
481
273
|
}
|
482
274
|
}
|
483
275
|
function disposeViewUnparentedVideo(context, internalContext, stream) {
|
484
276
|
const streamType = stream.mediaStreamType;
|
485
|
-
const streamLogInfo = { streamType };
|
486
|
-
|
487
|
-
name: EventNames.START_DISPOSE_LOCAL_STREAM,
|
488
|
-
level: 'info',
|
489
|
-
message: 'Start disposing unparented local stream.',
|
490
|
-
data: streamLogInfo
|
491
|
-
});
|
277
|
+
const streamLogInfo = { streamType, streamEventType: 'disposeViewUnparented' };
|
278
|
+
_logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);
|
492
279
|
context.deleteDeviceManagerUnparentedView(stream);
|
493
280
|
const renderInfo = internalContext.getUnparentedRenderInfo(stream);
|
494
281
|
if (!renderInfo) {
|
495
|
-
|
496
|
-
name: EventNames.LOCAL_DISPOSE_INFO_NOT_FOUND,
|
497
|
-
level: 'error',
|
498
|
-
message: 'Cannot find render info when disposing unparented local stream.',
|
499
|
-
data: streamLogInfo
|
500
|
-
});
|
282
|
+
_logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);
|
501
283
|
return;
|
502
284
|
}
|
503
285
|
if (renderInfo.status === 'Rendering') {
|
504
|
-
|
505
|
-
name: EventNames.LOCAL_STREAM_STOPPING,
|
506
|
-
level: 'info',
|
507
|
-
message: 'Unparented local stream is still rendering. Changing status to stopping.',
|
508
|
-
data: streamLogInfo
|
509
|
-
});
|
286
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
510
287
|
internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);
|
511
288
|
}
|
512
289
|
else {
|
513
290
|
internalContext.deleteUnparentedRenderInfo(stream);
|
514
291
|
}
|
515
292
|
if (renderInfo.renderer) {
|
516
|
-
|
517
|
-
name: EventNames.DISPOSING_LOCAL_RENDERER,
|
518
|
-
level: 'info',
|
519
|
-
message: 'Disposing unparented local view renderer.',
|
520
|
-
data: streamLogInfo
|
521
|
-
});
|
293
|
+
_logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);
|
522
294
|
renderInfo.renderer.dispose();
|
523
295
|
}
|
524
296
|
else {
|
525
|
-
|
526
|
-
name: EventNames.LOCAL_RENDERER_NOT_FOUND,
|
527
|
-
level: 'error',
|
528
|
-
message: 'Cannot find renderer when disposing unparented local stream.',
|
529
|
-
data: streamLogInfo
|
530
|
-
});
|
297
|
+
_logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);
|
531
298
|
}
|
532
299
|
}
|
533
300
|
/**
|
@@ -535,13 +302,8 @@ function disposeViewUnparentedVideo(context, internalContext, stream) {
|
|
535
302
|
*/
|
536
303
|
export function createView(context, internalContext, callId, participantId, stream, options) {
|
537
304
|
const streamType = stream.mediaStreamType;
|
538
|
-
if (
|
539
|
-
|
540
|
-
return createViewRemoteVideo(context, internalContext, callId, participantId, stream, options);
|
541
|
-
}
|
542
|
-
else if (!('id' in stream) && callId) {
|
543
|
-
// Render LocalVideoStream that is part of a Call
|
544
|
-
return createViewLocalVideo(context, internalContext, callId, options);
|
305
|
+
if (callId) {
|
306
|
+
return createViewVideo(context, internalContext, callId, stream, participantId, options);
|
545
307
|
}
|
546
308
|
else if (!('id' in stream) && !callId) {
|
547
309
|
// Render LocalVideoStream that is not part of a Call
|
@@ -550,12 +312,7 @@ export function createView(context, internalContext, callId, participantId, stre
|
|
550
312
|
return context.withAsyncErrorTeedToState(() => __awaiter(this, void 0, void 0, function* () { return yield createViewUnparentedVideo(context, internalContext, stream, options); }), 'Call.startVideo')();
|
551
313
|
}
|
552
314
|
else {
|
553
|
-
|
554
|
-
name: EventNames.CREATE_STREAM_INVALID_PARAMS,
|
555
|
-
level: 'warning',
|
556
|
-
message: 'Create View invalid combination of parameters.',
|
557
|
-
data: { streamType }
|
558
|
-
});
|
315
|
+
_logStreamEvent(EventNames.CREATE_STREAM_INVALID_PARAMS, { streamType });
|
559
316
|
return Promise.resolve(undefined);
|
560
317
|
}
|
561
318
|
}
|
@@ -564,13 +321,8 @@ export function createView(context, internalContext, callId, participantId, stre
|
|
564
321
|
*/
|
565
322
|
export function disposeView(context, internalContext, callId, participantId, stream) {
|
566
323
|
const streamType = stream.mediaStreamType;
|
567
|
-
if (
|
568
|
-
|
569
|
-
disposeViewRemoteVideo(context, internalContext, callId, participantId, stream);
|
570
|
-
}
|
571
|
-
else if (!('id' in stream) && callId) {
|
572
|
-
// Stop rendering LocalVideoStream that is part of a Call
|
573
|
-
disposeViewLocalVideo(context, internalContext, callId);
|
324
|
+
if (callId) {
|
325
|
+
disposeViewVideo(context, internalContext, callId, stream, participantId);
|
574
326
|
}
|
575
327
|
else if (!('id' in stream) && !callId) {
|
576
328
|
// Stop rendering LocalVideoStream that is not part of a Call
|
@@ -579,12 +331,7 @@ export function disposeView(context, internalContext, callId, participantId, str
|
|
579
331
|
context.withErrorTeedToState(() => disposeViewUnparentedVideo(context, internalContext, stream), 'Call.stopVideo')();
|
580
332
|
}
|
581
333
|
else {
|
582
|
-
|
583
|
-
name: EventNames.DISPOSE_STREAM_INVALID_PARAMS,
|
584
|
-
level: 'warning',
|
585
|
-
message: 'Dispose View invalid combination of parameters.',
|
586
|
-
data: { streamType }
|
587
|
-
});
|
334
|
+
_logStreamEvent(EventNames.DISPOSE_STREAM_INVALID_PARAMS, { streamType });
|
588
335
|
return;
|
589
336
|
}
|
590
337
|
}
|