@azure/communication-react 1.5.1-alpha-202303050016 → 1.5.1-alpha-202303080017
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 +10 -1
- package/dist/dist-cjs/communication-react/index.js +376 -400
- 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/react-components/src/components/VerticalGallery.js +8 -2
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/PresetVideoEffectsItems.d.ts +21 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/PresetVideoEffectsItems.js +65 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/PresetVideoEffectsItems.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.d.ts +88 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js +80 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/index.d.ts +3 -0
- package/dist/dist-esm/react-components/src/components/index.js +2 -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-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
@@ -6,6 +6,7 @@ var communicationCommon = require('@azure/communication-common');
|
|
6
6
|
var reselect = require('reselect');
|
7
7
|
var communicationCalling = require('@azure/communication-calling');
|
8
8
|
var memoizeOne = require('memoize-one');
|
9
|
+
var communicationCallingEffects = require('@azure/communication-calling-effects');
|
9
10
|
var logger = require('@azure/logger');
|
10
11
|
var EventEmitter = require('events');
|
11
12
|
var produce = require('immer');
|
@@ -161,7 +162,7 @@ const _toCommunicationIdentifier = (id) => {
|
|
161
162
|
// Copyright (c) Microsoft Corporation.
|
162
163
|
// Licensed under the MIT license.
|
163
164
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
164
|
-
var telemetryVersion = '1.5.1-alpha-
|
165
|
+
var telemetryVersion = '1.5.1-alpha-202303080017';
|
165
166
|
|
166
167
|
// Copyright (c) Microsoft Corporation.
|
167
168
|
/**
|
@@ -784,6 +785,30 @@ const createDefaultCommonCallingHandlers = memoizeOne__default['default']((callC
|
|
784
785
|
yield (deviceManager === null || deviceManager === void 0 ? void 0 : deviceManager.askDevicePermission(constrain));
|
785
786
|
}
|
786
787
|
});
|
788
|
+
/* @conditional-compile-remove(video-background-effects) */
|
789
|
+
const onRemoveVideoBackgroundEffects = () => __awaiter$D(void 0, void 0, void 0, function* () {
|
790
|
+
const stream = (call === null || call === void 0 ? void 0 : call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video')) ||
|
791
|
+
(deviceManager === null || deviceManager === void 0 ? void 0 : deviceManager.getUnparentedVideoStreams().find((stream) => stream.mediaStreamType === 'Video'));
|
792
|
+
if (stream) {
|
793
|
+
return stream.feature(communicationCalling.Features.VideoEffects).stopEffects();
|
794
|
+
}
|
795
|
+
});
|
796
|
+
/* @conditional-compile-remove(video-background-effects) */
|
797
|
+
const onBlurVideoBackground = (bgBlurConfig) => __awaiter$D(void 0, void 0, void 0, function* () {
|
798
|
+
const stream = (call === null || call === void 0 ? void 0 : call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video')) ||
|
799
|
+
(deviceManager === null || deviceManager === void 0 ? void 0 : deviceManager.getUnparentedVideoStreams().find((stream) => stream.mediaStreamType === 'Video'));
|
800
|
+
if (stream) {
|
801
|
+
return stream.feature(communicationCalling.Features.VideoEffects).startEffects(new communicationCallingEffects.BackgroundBlurEffect(bgBlurConfig));
|
802
|
+
}
|
803
|
+
});
|
804
|
+
/* @conditional-compile-remove(video-background-effects) */
|
805
|
+
const onReplaceVideoBackground = (bgReplacementConfig) => __awaiter$D(void 0, void 0, void 0, function* () {
|
806
|
+
const stream = (call === null || call === void 0 ? void 0 : call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video')) ||
|
807
|
+
(deviceManager === null || deviceManager === void 0 ? void 0 : deviceManager.getUnparentedVideoStreams().find((stream) => stream.mediaStreamType === 'Video'));
|
808
|
+
if (stream) {
|
809
|
+
return stream.feature(communicationCalling.Features.VideoEffects).startEffects(new communicationCallingEffects.BackgroundReplacementEffect(bgReplacementConfig));
|
810
|
+
}
|
811
|
+
});
|
787
812
|
return {
|
788
813
|
onHangUp,
|
789
814
|
/* @conditional-compile-remove(PSTN-calls) */
|
@@ -807,7 +832,13 @@ const createDefaultCommonCallingHandlers = memoizeOne__default['default']((callC
|
|
807
832
|
onStartCall: notImplemented,
|
808
833
|
/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ onSendDtmfTone,
|
809
834
|
/* @conditional-compile-remove(call-readiness) */
|
810
|
-
askDevicePermission
|
835
|
+
askDevicePermission,
|
836
|
+
/* @conditional-compile-remove(video-background-effects) */
|
837
|
+
onRemoveVideoBackgroundEffects,
|
838
|
+
/* @conditional-compile-remove(video-background-effects) */
|
839
|
+
onBlurVideoBackground,
|
840
|
+
/* @conditional-compile-remove(video-background-effects) */
|
841
|
+
onReplaceVideoBackground
|
811
842
|
};
|
812
843
|
});
|
813
844
|
|
@@ -1073,7 +1104,7 @@ const deviceManagerDeclaratify = (deviceManager, context, internalContext) => {
|
|
1073
1104
|
value: (videoDeviceInfo) => proxyDeviceManager.selectCamera(videoDeviceInfo)
|
1074
1105
|
});
|
1075
1106
|
/* @conditional-compile-remove(video-background-effects) */
|
1076
|
-
Object.defineProperty(deviceManager, '
|
1107
|
+
Object.defineProperty(deviceManager, 'getUnparentedVideoStreams', {
|
1077
1108
|
configurable: false,
|
1078
1109
|
value: () => internalContext.getUnparentedRenderInfos()
|
1079
1110
|
});
|
@@ -1110,38 +1141,25 @@ const callingStatefulLogger = logger.createClientLogger('communication-react:cal
|
|
1110
1141
|
var EventNames;
|
1111
1142
|
(function (EventNames) {
|
1112
1143
|
// Info
|
1113
|
-
EventNames["
|
1114
|
-
EventNames["
|
1115
|
-
EventNames["
|
1116
|
-
EventNames["
|
1117
|
-
EventNames["
|
1118
|
-
EventNames["DISPOSING_REMOTE_RENDERER"] = "DISPOSING_REMOTE_RENDERER";
|
1119
|
-
EventNames["CREATING_REMOTE_VIEW"] = "CREATING_REMOTE_VIEW";
|
1120
|
-
EventNames["REMOTE_VIEW_RENDER_SUCCEED"] = "REMOTE_VIEW_RENDER_SUCCEED";
|
1144
|
+
EventNames["VIEW_RENDER_SUCCEED"] = "VIEW_RENDER_SUCCEED";
|
1145
|
+
EventNames["START_DISPOSE_STREAM"] = "START_DISPOSE_STREAM";
|
1146
|
+
EventNames["START_STREAM_RENDERING"] = "START_STREAM_RENDERING";
|
1147
|
+
EventNames["DISPOSING_RENDERER"] = "DISPOSING_RENDERER";
|
1148
|
+
EventNames["CREATING_VIEW"] = "CREATING_VIEW";
|
1121
1149
|
// Warning
|
1122
1150
|
EventNames["CREATE_STREAM_INVALID_PARAMS"] = "CREATE_STREAM_INVALID_PARAMS";
|
1123
|
-
EventNames["DISPOSE_STREAM_INVALID_PARAMS"] = "
|
1124
|
-
EventNames["
|
1125
|
-
EventNames["
|
1126
|
-
EventNames["
|
1127
|
-
EventNames["
|
1128
|
-
EventNames["
|
1129
|
-
EventNames["REMOTE_STREAM_ALREADY_RENDERED"] = "REMOTE_STREAM_ALREADY_RENDERED";
|
1130
|
-
EventNames["REMOTE_STREAM_RENDERING"] = "REMOTE_STREAM_RENDERING";
|
1131
|
-
EventNames["REMOTE_STREAM_ALREADY_DISPOSED"] = "REMOTE_STREAM_ALREADY_DISPOSED";
|
1132
|
-
EventNames["REMOTE_STREAM_STOPPING"] = "REMOTE_STREAM_STOPPING";
|
1133
|
-
EventNames["REMOTE_CREATED_STREAM_STOPPING"] = "REMOTE_CREATED_STREAM_STOPPING";
|
1151
|
+
EventNames["DISPOSE_STREAM_INVALID_PARAMS"] = "DISPOSE_STREAM_INVALID_PARAMS";
|
1152
|
+
EventNames["STREAM_ALREADY_RENDERED"] = "STREAM_ALREADY_RENDERED";
|
1153
|
+
EventNames["STREAM_ALREADY_DISPOSED"] = "STREAM_ALREADY_DISPOSED";
|
1154
|
+
EventNames["STREAM_STOPPING"] = "STREAM_STOPPING";
|
1155
|
+
EventNames["CREATED_STREAM_STOPPING"] = "CREATED_STREAM_STOPPING";
|
1156
|
+
EventNames["STREAM_RENDERING"] = "STREAM_RENDERING";
|
1134
1157
|
// Error
|
1135
|
-
EventNames["
|
1136
|
-
EventNames["
|
1137
|
-
EventNames["
|
1138
|
-
EventNames["
|
1139
|
-
EventNames["
|
1140
|
-
EventNames["REMOTE_RENDER_INFO_NOT_FOUND"] = "REMOTE_RENDER_INFO_NOT_FOUND";
|
1141
|
-
EventNames["LOCAL_RENDERER_NOT_FOUND"] = "LOCAL_RENDERER_NOT_FOUND";
|
1142
|
-
EventNames["REMOTE_RENDERER_NOT_FOUND"] = "REMOTE_RENDERER_NOT_FOUND";
|
1143
|
-
EventNames["CREATE_REMOTE_STREAM_FAIL"] = "CREATE_REMOTE_STREAM_FAIL";
|
1144
|
-
EventNames["CREATE_LOCAL_STREAM_FAIL"] = "CREATE_LOCAL_STREAM_FAIL";
|
1158
|
+
EventNames["STREAM_NOT_FOUND"] = "STREAM_NOT_FOUND";
|
1159
|
+
EventNames["RENDER_INFO_NOT_FOUND"] = "RENDER_INFO_NOT_FOUND";
|
1160
|
+
EventNames["DISPOSE_INFO_NOT_FOUND"] = "DISPOSE_INFO_NOT_FOUND";
|
1161
|
+
EventNames["RENDERER_NOT_FOUND"] = "RENDERER_NOT_FOUND";
|
1162
|
+
EventNames["CREATE_STREAM_FAIL"] = "CREATE_STREAM_FAIL";
|
1145
1163
|
})(EventNames || (EventNames = {}));
|
1146
1164
|
|
1147
1165
|
// Copyright (c) Microsoft Corporation.
|
@@ -2099,258 +2117,327 @@ class RemoteVideoStreamSubscriber {
|
|
2099
2117
|
}
|
2100
2118
|
|
2101
2119
|
// Copyright (c) Microsoft Corporation.
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
}
|
2121
|
-
else {
|
2122
|
-
participantKey = toFlatCommunicationIdentifier(participantId);
|
2123
|
-
}
|
2124
|
-
const streamLogInfo = { callId, participantKey, streamId, streamType };
|
2125
|
-
_logEvent(callingStatefulLogger, {
|
2126
|
-
name: EventNames.CREATING_REMOTE_VIEW,
|
2127
|
-
level: 'info',
|
2128
|
-
message: 'Start creating view for remote video.',
|
2129
|
-
data: streamLogInfo
|
2130
|
-
});
|
2131
|
-
const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);
|
2132
|
-
if (!renderInfo) {
|
2120
|
+
/**
|
2121
|
+
* helper function to manage logging for stream disposals
|
2122
|
+
*
|
2123
|
+
* @param eventName Name of event that occured when managing streams
|
2124
|
+
* @param streamLogInfo Data about the stream in the event
|
2125
|
+
* @returns
|
2126
|
+
*/
|
2127
|
+
function _logDisposeStreamEvent(eventName, streamLogInfo) {
|
2128
|
+
switch (eventName) {
|
2129
|
+
case EventNames.DISPOSE_STREAM_INVALID_PARAMS:
|
2130
|
+
_logEvent(callingStatefulLogger, {
|
2131
|
+
name: EventNames.DISPOSE_STREAM_INVALID_PARAMS,
|
2132
|
+
level: 'warning',
|
2133
|
+
message: 'Dispose View invalid combination of parameters.',
|
2134
|
+
data: { streamType: streamLogInfo.streamType }
|
2135
|
+
});
|
2136
|
+
return;
|
2137
|
+
case EventNames.START_DISPOSE_STREAM:
|
2133
2138
|
_logEvent(callingStatefulLogger, {
|
2134
|
-
name: EventNames.
|
2139
|
+
name: EventNames.START_DISPOSE_STREAM,
|
2140
|
+
level: 'info',
|
2141
|
+
message: 'Start disposing stream.',
|
2142
|
+
data: streamLogInfo
|
2143
|
+
});
|
2144
|
+
return;
|
2145
|
+
case EventNames.DISPOSE_INFO_NOT_FOUND:
|
2146
|
+
_logEvent(callingStatefulLogger, {
|
2147
|
+
name: EventNames.DISPOSE_INFO_NOT_FOUND,
|
2135
2148
|
level: 'error',
|
2136
|
-
message: '
|
2149
|
+
message: 'Cannot find render info when disposing stream.',
|
2137
2150
|
data: streamLogInfo
|
2138
2151
|
});
|
2139
|
-
console.warn('RemoteVideoStream not found in state');
|
2140
2152
|
return;
|
2141
|
-
|
2142
|
-
|
2153
|
+
case EventNames.STREAM_STOPPING:
|
2154
|
+
_logEvent(callingStatefulLogger, {
|
2155
|
+
name: EventNames.STREAM_STOPPING,
|
2156
|
+
level: 'info',
|
2157
|
+
message: 'Stream is currently marked as stopping, will continue if is local preview',
|
2158
|
+
data: streamLogInfo
|
2159
|
+
});
|
2160
|
+
return;
|
2161
|
+
case EventNames.DISPOSING_RENDERER:
|
2162
|
+
_logEvent(callingStatefulLogger, {
|
2163
|
+
name: EventNames.DISPOSING_RENDERER,
|
2164
|
+
level: 'info',
|
2165
|
+
message: 'Disposing view renderer.',
|
2166
|
+
data: streamLogInfo
|
2167
|
+
});
|
2168
|
+
return;
|
2169
|
+
case EventNames.RENDERER_NOT_FOUND:
|
2170
|
+
_logEvent(callingStatefulLogger, {
|
2171
|
+
name: EventNames.RENDERER_NOT_FOUND,
|
2172
|
+
level: 'error',
|
2173
|
+
message: 'Cannot find renderer when disposing stream.',
|
2174
|
+
data: streamLogInfo
|
2175
|
+
});
|
2176
|
+
return;
|
2177
|
+
case EventNames.STREAM_ALREADY_DISPOSED:
|
2178
|
+
_logEvent(callingStatefulLogger, {
|
2179
|
+
name: EventNames.STREAM_ALREADY_DISPOSED,
|
2180
|
+
level: 'info',
|
2181
|
+
message: 'Stream is already disposed.',
|
2182
|
+
data: streamLogInfo
|
2183
|
+
});
|
2184
|
+
return;
|
2185
|
+
default:
|
2186
|
+
return;
|
2187
|
+
}
|
2188
|
+
}
|
2189
|
+
/**
|
2190
|
+
* helper function to manage logging for local stream creations
|
2191
|
+
*
|
2192
|
+
* @param eventName Name of the event to occured when creating a local stream
|
2193
|
+
* @param streamLogInfo Data about the stream in the event
|
2194
|
+
* @param error that is thrown by caller
|
2195
|
+
* @returns
|
2196
|
+
*/
|
2197
|
+
function _logCreateStreamEvent(eventName, streamLogInfo, error) {
|
2198
|
+
switch (eventName) {
|
2199
|
+
case EventNames.CREATE_STREAM_INVALID_PARAMS:
|
2200
|
+
_logEvent(callingStatefulLogger, {
|
2201
|
+
name: EventNames.CREATE_STREAM_INVALID_PARAMS,
|
2202
|
+
level: 'warning',
|
2203
|
+
message: 'Create View invalid combination of parameters.',
|
2204
|
+
data: { streamType: streamLogInfo.streamType }
|
2205
|
+
});
|
2206
|
+
return;
|
2207
|
+
case EventNames.START_STREAM_RENDERING:
|
2143
2208
|
_logEvent(callingStatefulLogger, {
|
2144
|
-
name: EventNames.
|
2209
|
+
name: EventNames.START_STREAM_RENDERING,
|
2210
|
+
level: 'info',
|
2211
|
+
message: 'Start creating view for local video.',
|
2212
|
+
data: streamLogInfo
|
2213
|
+
});
|
2214
|
+
return;
|
2215
|
+
case EventNames.STREAM_NOT_FOUND:
|
2216
|
+
_logEvent(callingStatefulLogger, {
|
2217
|
+
name: EventNames.STREAM_NOT_FOUND,
|
2218
|
+
level: 'error',
|
2219
|
+
message: 'Stream not found in state.',
|
2220
|
+
data: { callId: streamLogInfo.callId }
|
2221
|
+
});
|
2222
|
+
return;
|
2223
|
+
case EventNames.STREAM_ALREADY_RENDERED:
|
2224
|
+
_logEvent(callingStatefulLogger, {
|
2225
|
+
name: EventNames.STREAM_ALREADY_RENDERED,
|
2145
2226
|
level: 'warning',
|
2146
|
-
message: '
|
2227
|
+
message: 'Stream is already rendered.',
|
2147
2228
|
data: streamLogInfo
|
2148
2229
|
});
|
2149
|
-
console.warn('RemoteVideoStream is already rendered');
|
2150
2230
|
return;
|
2151
|
-
|
2152
|
-
if (renderInfo.status === 'Rendering') {
|
2153
|
-
// Do not log to console here as this is a very common situation due to UI rerenders while
|
2154
|
-
// the video rendering is in progress.
|
2231
|
+
case EventNames.STREAM_RENDERING:
|
2155
2232
|
_logEvent(callingStatefulLogger, {
|
2156
|
-
name: EventNames.
|
2233
|
+
name: EventNames.STREAM_RENDERING,
|
2157
2234
|
level: 'warning',
|
2158
|
-
message: '
|
2235
|
+
message: 'Stream is rendering.',
|
2159
2236
|
data: streamLogInfo
|
2160
2237
|
});
|
2161
2238
|
return;
|
2162
|
-
|
2163
|
-
// "Stopping" only happens if the stream was in "rendering" but `disposeView` was called.
|
2164
|
-
// Now that `createView` has been re-called, we can flip the state back to "rendering".
|
2165
|
-
if (renderInfo.status === 'Stopping') {
|
2239
|
+
case EventNames.STREAM_STOPPING:
|
2166
2240
|
_logEvent(callingStatefulLogger, {
|
2167
|
-
name: EventNames.
|
2241
|
+
name: EventNames.STREAM_STOPPING,
|
2168
2242
|
level: 'warning',
|
2169
|
-
message: '
|
2243
|
+
message: 'Stream was marked as stopping by dispose view. Resetting state to "Rendering".',
|
2170
2244
|
data: streamLogInfo
|
2171
2245
|
});
|
2172
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
2173
2246
|
return;
|
2174
|
-
|
2175
|
-
const renderer = new communicationCalling.VideoStreamRenderer(renderInfo.stream);
|
2176
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', undefined);
|
2177
|
-
let view;
|
2178
|
-
try {
|
2179
|
-
view = yield renderer.createView(options);
|
2180
|
-
}
|
2181
|
-
catch (e) {
|
2247
|
+
case EventNames.CREATE_STREAM_FAIL:
|
2182
2248
|
_logEvent(callingStatefulLogger, {
|
2183
|
-
name: EventNames.
|
2249
|
+
name: EventNames.CREATE_STREAM_FAIL,
|
2184
2250
|
level: 'error',
|
2185
|
-
message: 'Failed to create
|
2186
|
-
data:
|
2251
|
+
message: 'Failed to create view.',
|
2252
|
+
data: {
|
2253
|
+
error: error,
|
2254
|
+
streamType: streamLogInfo.streamType,
|
2255
|
+
callId: streamLogInfo.callId
|
2256
|
+
}
|
2187
2257
|
});
|
2188
|
-
|
2189
|
-
|
2190
|
-
}
|
2191
|
-
// Since render could take some time, we need to check if the stream is still valid and if we received a signal to
|
2192
|
-
// stop rendering.
|
2193
|
-
const refreshedRenderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);
|
2194
|
-
if (!refreshedRenderInfo) {
|
2195
|
-
// RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer
|
2196
|
-
// and clean up state.
|
2258
|
+
return;
|
2259
|
+
case EventNames.RENDER_INFO_NOT_FOUND:
|
2197
2260
|
_logEvent(callingStatefulLogger, {
|
2198
|
-
name: EventNames.
|
2261
|
+
name: EventNames.RENDER_INFO_NOT_FOUND,
|
2199
2262
|
level: 'error',
|
2200
|
-
message: 'Cannot find
|
2263
|
+
message: 'Cannot find render info after create the view. ',
|
2201
2264
|
data: streamLogInfo
|
2202
2265
|
});
|
2203
|
-
renderer.dispose();
|
2204
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
2205
2266
|
return;
|
2206
|
-
|
2207
|
-
if (refreshedRenderInfo.status === 'Stopping') {
|
2208
|
-
// Stop render was called on this stream after we had started rendering. We will dispose this view and do not
|
2209
|
-
// put the view into the state.
|
2267
|
+
case EventNames.CREATED_STREAM_STOPPING:
|
2210
2268
|
_logEvent(callingStatefulLogger, {
|
2211
|
-
name: EventNames.
|
2269
|
+
name: EventNames.CREATED_STREAM_STOPPING,
|
2212
2270
|
level: 'warning',
|
2213
2271
|
message: 'Render info status is stopping, dispose renderer.',
|
2214
2272
|
data: streamLogInfo
|
2215
2273
|
});
|
2216
|
-
renderer.dispose();
|
2217
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
2218
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
2219
2274
|
return;
|
2220
|
-
|
2221
|
-
// Else the stream still exists and status is not telling us to stop rendering. Complete the render process by
|
2222
|
-
// updating the state.
|
2223
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
2224
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
2225
|
-
_logEvent(callingStatefulLogger, {
|
2226
|
-
name: EventNames.REMOTE_VIEW_RENDER_SUCCEED,
|
2227
|
-
level: 'info',
|
2228
|
-
message: `Successfully render the remote view.`,
|
2229
|
-
data: {
|
2230
|
-
streamLogInfo
|
2231
|
-
}
|
2232
|
-
});
|
2233
|
-
return {
|
2234
|
-
renderer,
|
2235
|
-
view
|
2236
|
-
};
|
2237
|
-
});
|
2238
|
-
}
|
2239
|
-
function createViewLocalVideo(context, internalContext, callId, options) {
|
2240
|
-
return __awaiter$y(this, void 0, void 0, function* () {
|
2241
|
-
// Render LocalVideoStream that is part of a Call
|
2242
|
-
const renderInfo = internalContext.getLocalRenderInfo(callId);
|
2243
|
-
const streamType = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.stream.mediaStreamType;
|
2244
|
-
const streamLogInfo = { callId, streamType };
|
2245
|
-
_logEvent(callingStatefulLogger, {
|
2246
|
-
name: EventNames.START_LOCAL_STREAM_RENDERING,
|
2247
|
-
level: 'info',
|
2248
|
-
message: 'Start creating view for local video.',
|
2249
|
-
data: streamLogInfo
|
2250
|
-
});
|
2251
|
-
if (!renderInfo) {
|
2275
|
+
case EventNames.VIEW_RENDER_SUCCEED:
|
2252
2276
|
_logEvent(callingStatefulLogger, {
|
2253
|
-
name: EventNames.
|
2254
|
-
level: '
|
2255
|
-
message:
|
2256
|
-
data:
|
2277
|
+
name: EventNames.VIEW_RENDER_SUCCEED,
|
2278
|
+
level: 'info',
|
2279
|
+
message: `Successfully render the view.`,
|
2280
|
+
data: streamLogInfo
|
2257
2281
|
});
|
2258
|
-
console.warn('LocalVideoStream not found in state');
|
2259
2282
|
return;
|
2260
|
-
|
2261
|
-
if (renderInfo.status === 'Rendered') {
|
2283
|
+
case EventNames.CREATING_VIEW:
|
2262
2284
|
_logEvent(callingStatefulLogger, {
|
2263
|
-
name: EventNames.
|
2264
|
-
level: '
|
2265
|
-
message: '
|
2285
|
+
name: EventNames.CREATING_VIEW,
|
2286
|
+
level: 'info',
|
2287
|
+
message: 'Start creating view for remote video.',
|
2266
2288
|
data: streamLogInfo
|
2267
2289
|
});
|
2268
|
-
|
2290
|
+
return;
|
2291
|
+
default:
|
2292
|
+
return;
|
2293
|
+
}
|
2294
|
+
}
|
2295
|
+
/**
|
2296
|
+
* helper function to fire streamUtils logging events
|
2297
|
+
*
|
2298
|
+
* @param eventName Name of event from streamUtils
|
2299
|
+
* @param streamLogInfo informaiton about the event and who called it
|
2300
|
+
* @param error if any errors present will be added to message in logging
|
2301
|
+
*/
|
2302
|
+
function _logStreamEvent(eventName, streamLogInfo, error) {
|
2303
|
+
if (streamLogInfo.streamEventType === 'disposeViewLocal' ||
|
2304
|
+
streamLogInfo.streamEventType === 'disposeViewRemote' ||
|
2305
|
+
streamLogInfo.streamEventType === 'disposeViewUnparented') {
|
2306
|
+
_logDisposeStreamEvent(eventName, streamLogInfo);
|
2307
|
+
}
|
2308
|
+
else if (streamLogInfo.streamEventType === 'createViewLocal' ||
|
2309
|
+
streamLogInfo.streamEventType === 'createViewRemote') {
|
2310
|
+
_logCreateStreamEvent(eventName, streamLogInfo, error);
|
2311
|
+
}
|
2312
|
+
}
|
2313
|
+
|
2314
|
+
// Copyright (c) Microsoft Corporation.
|
2315
|
+
// Licensed under the MIT license.
|
2316
|
+
var __awaiter$y = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2317
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
2318
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
2319
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2320
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2321
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
2322
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2323
|
+
});
|
2324
|
+
};
|
2325
|
+
function createViewVideo(context, internalContext, callId, stream, participantId, options) {
|
2326
|
+
return __awaiter$y(this, void 0, void 0, function* () {
|
2327
|
+
// we can only have 3 types of createView
|
2328
|
+
let streamEventType;
|
2329
|
+
// we will reuse these for local as well but we need to make sure the remote stream is passed in like before.
|
2330
|
+
if (participantId) {
|
2331
|
+
streamEventType = 'createViewRemote';
|
2332
|
+
}
|
2333
|
+
else if (callId) {
|
2334
|
+
streamEventType = 'createViewLocal';
|
2335
|
+
}
|
2336
|
+
else {
|
2337
|
+
// TODO update for when unparented view.
|
2338
|
+
throw new Error('unparented createView not implemented yet here');
|
2339
|
+
}
|
2340
|
+
const streamType = stream === null || stream === void 0 ? void 0 : stream.mediaStreamType;
|
2341
|
+
const streamId = stream.id;
|
2342
|
+
// we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.
|
2343
|
+
const participantKey = streamEventType === 'createViewRemote' && participantId
|
2344
|
+
? typeof participantId === 'string'
|
2345
|
+
? participantId
|
2346
|
+
: toFlatCommunicationIdentifier(participantId)
|
2347
|
+
: undefined;
|
2348
|
+
const streamLogInfo = { callId, participantKey, streamId, streamType, streamEventType };
|
2349
|
+
// make different logging announcement based on whether or not we are starting a local or remote
|
2350
|
+
_logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);
|
2351
|
+
// if we have a participant Id and a stream get the remote info, else get the local render info from state.
|
2352
|
+
const renderInfo = streamEventType === 'createViewRemote' && participantKey
|
2353
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)
|
2354
|
+
: internalContext.getLocalRenderInfo(callId);
|
2355
|
+
if (!renderInfo) {
|
2356
|
+
_logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);
|
2357
|
+
return;
|
2358
|
+
}
|
2359
|
+
if (renderInfo.status === 'Rendered') {
|
2360
|
+
_logStreamEvent(EventNames.STREAM_ALREADY_RENDERED, streamLogInfo);
|
2269
2361
|
return;
|
2270
2362
|
}
|
2271
2363
|
if (renderInfo.status === 'Rendering') {
|
2272
2364
|
// Do not log to console here as this is a very common situation due to UI rerenders while
|
2273
2365
|
// the video rendering is in progress.
|
2274
|
-
|
2275
|
-
name: EventNames.LOCAL_STREAM_RENDERING,
|
2276
|
-
level: 'warning',
|
2277
|
-
message: 'LocalVideoStream is rendering.',
|
2278
|
-
data: streamLogInfo
|
2279
|
-
});
|
2366
|
+
_logStreamEvent(EventNames.STREAM_RENDERING, streamLogInfo);
|
2280
2367
|
return;
|
2281
2368
|
}
|
2282
2369
|
// "Stopping" only happens if the stream was in "rendering" but `disposeView` was called.
|
2283
2370
|
// Now that `createView` has been re-called, we can flip the state back to "rendering".
|
2284
2371
|
if (renderInfo.status === 'Stopping') {
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2372
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
2373
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
2374
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
2375
|
+
}
|
2376
|
+
else if (streamEventType === 'createViewLocal') {
|
2377
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
2378
|
+
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
2379
|
+
}
|
2292
2380
|
return;
|
2293
2381
|
}
|
2294
2382
|
const renderer = new communicationCalling.VideoStreamRenderer(renderInfo.stream);
|
2295
|
-
|
2383
|
+
streamEventType === 'createViewRemote' && participantKey
|
2384
|
+
? internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Rendering', undefined)
|
2385
|
+
: internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderer);
|
2296
2386
|
let view;
|
2297
2387
|
try {
|
2298
2388
|
view = yield renderer.createView(options);
|
2299
2389
|
}
|
2300
2390
|
catch (e) {
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
}
|
2310
|
-
});
|
2311
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
2391
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
2392
|
+
_logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);
|
2393
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);
|
2394
|
+
}
|
2395
|
+
else if (streamEventType === 'createViewLocal') {
|
2396
|
+
_logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);
|
2397
|
+
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
2398
|
+
}
|
2312
2399
|
throw e;
|
2313
2400
|
}
|
2314
2401
|
// Since render could take some time, we need to check if the stream is still valid and if we received a signal to
|
2315
2402
|
// stop rendering.
|
2316
|
-
const refreshedRenderInfo =
|
2403
|
+
const refreshedRenderInfo = streamEventType === 'createViewRemote' && participantKey
|
2404
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)
|
2405
|
+
: internalContext.getLocalRenderInfo(callId);
|
2317
2406
|
if (!refreshedRenderInfo) {
|
2318
2407
|
// RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer
|
2319
2408
|
// and clean up the state.
|
2320
|
-
|
2321
|
-
name: EventNames.LOCAL_RENDER_INFO_NOT_FOUND,
|
2322
|
-
level: 'error',
|
2323
|
-
message: 'Cannot find local render info after create the view. ',
|
2324
|
-
data: streamLogInfo
|
2325
|
-
});
|
2409
|
+
_logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);
|
2326
2410
|
renderer.dispose();
|
2327
|
-
|
2411
|
+
streamEventType === 'createViewRemote' && participantKey
|
2412
|
+
? context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined)
|
2413
|
+
: context.setLocalVideoStreamRendererView(callId, undefined);
|
2328
2414
|
return;
|
2329
2415
|
}
|
2330
2416
|
if (refreshedRenderInfo.status === 'Stopping') {
|
2331
|
-
|
2332
|
-
// put the view into the state.
|
2333
|
-
_logEvent(callingStatefulLogger, {
|
2334
|
-
name: EventNames.LOCAL_CREATED_STREAM_STOPPING,
|
2335
|
-
level: 'warning',
|
2336
|
-
message: 'Render info status is stopping, dispose renderer.',
|
2337
|
-
data: streamLogInfo
|
2338
|
-
});
|
2417
|
+
_logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);
|
2339
2418
|
renderer.dispose();
|
2340
|
-
|
2341
|
-
|
2419
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
2420
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
2421
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
2422
|
+
}
|
2423
|
+
else if (streamEventType === 'createViewLocal') {
|
2424
|
+
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
2425
|
+
context.setLocalVideoStreamRendererView(callId, undefined);
|
2426
|
+
}
|
2342
2427
|
return;
|
2343
2428
|
}
|
2344
|
-
// Else
|
2429
|
+
// Else the stream still exists and status is not telling us to stop rendering. Complete the render process by
|
2345
2430
|
// updating the state.
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2431
|
+
if (streamEventType === 'createViewRemote' && participantKey) {
|
2432
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
2433
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
2434
|
+
_logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);
|
2435
|
+
}
|
2436
|
+
else if (streamEventType === 'createViewLocal') {
|
2437
|
+
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
2438
|
+
context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
2439
|
+
_logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);
|
2440
|
+
}
|
2354
2441
|
return {
|
2355
2442
|
renderer,
|
2356
2443
|
view
|
@@ -2417,213 +2504,101 @@ function createViewUnparentedVideo(context, internalContext, stream, options) {
|
|
2417
2504
|
};
|
2418
2505
|
});
|
2419
2506
|
}
|
2420
|
-
function
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
if (
|
2425
|
-
|
2507
|
+
function disposeViewVideo(context, internalContext, callId, stream, participantId) {
|
2508
|
+
// we can only have 3 types of createView
|
2509
|
+
let streamEventType;
|
2510
|
+
// we will reuse these for local as well but we need to make sure the remote stream is passed in like before.
|
2511
|
+
if (participantId) {
|
2512
|
+
streamEventType = 'disposeViewRemote';
|
2513
|
+
}
|
2514
|
+
else if (callId) {
|
2515
|
+
streamEventType = 'disposeViewLocal';
|
2426
2516
|
}
|
2427
2517
|
else {
|
2428
|
-
|
2518
|
+
// TODO update for when unparented view.
|
2519
|
+
streamEventType = 'disposeViewUnparented';
|
2429
2520
|
}
|
2521
|
+
const streamType = stream.mediaStreamType;
|
2522
|
+
const streamId = stream.id;
|
2523
|
+
// we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.
|
2524
|
+
const participantKey = streamEventType === 'disposeViewRemote' && participantId
|
2525
|
+
? typeof participantId === 'string'
|
2526
|
+
? participantId
|
2527
|
+
: toFlatCommunicationIdentifier(participantId)
|
2528
|
+
: undefined;
|
2430
2529
|
const streamLogInfo = { callId, participantKey, streamId, streamType };
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
message: 'Start disposing remote stream.',
|
2435
|
-
data: streamLogInfo
|
2436
|
-
});
|
2437
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
2438
|
-
const renderInfo = internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId);
|
2439
|
-
if (!renderInfo) {
|
2440
|
-
_logEvent(callingStatefulLogger, {
|
2441
|
-
name: EventNames.REMOTE_DISPOSE_INFO_NOT_FOUND,
|
2442
|
-
level: 'error',
|
2443
|
-
message: 'Cannot find render info when disposing remote stream.',
|
2444
|
-
data: streamLogInfo
|
2445
|
-
});
|
2446
|
-
return;
|
2447
|
-
}
|
2448
|
-
// Nothing to dispose of or clean up -- we can safely exit early here.
|
2449
|
-
if (renderInfo.status === 'NotRendered') {
|
2450
|
-
_logEvent(callingStatefulLogger, {
|
2451
|
-
name: EventNames.REMOTE_STREAM_ALREADY_DISPOSED,
|
2452
|
-
level: 'info',
|
2453
|
-
message: 'RemoteVideoStream is already disposed.',
|
2454
|
-
data: streamLogInfo
|
2455
|
-
});
|
2456
|
-
return;
|
2457
|
-
}
|
2458
|
-
// Status is already marked as "stopping" so we can exit early here. This is because stopping only occurs
|
2459
|
-
// when the stream is being created in createView but hasn't been completed being created yet. The createView
|
2460
|
-
// method will see the "stopping" status and perform the cleanup
|
2461
|
-
if (renderInfo.status === 'Stopping') {
|
2462
|
-
_logEvent(callingStatefulLogger, {
|
2463
|
-
name: EventNames.REMOTE_STREAM_STOPPING,
|
2464
|
-
level: 'info',
|
2465
|
-
message: 'Remote stream is already stopping.',
|
2466
|
-
data: streamLogInfo
|
2467
|
-
});
|
2468
|
-
return;
|
2469
|
-
}
|
2470
|
-
// If the stream is in the middle of being rendered (i.e. has state "Rendering"), we need the status as
|
2471
|
-
// "stopping" without performing any cleanup. This will tell the `createView` method that it should stop
|
2472
|
-
// rendering and clean up the state once the view has finished being created.
|
2473
|
-
if (renderInfo.status === 'Rendering') {
|
2474
|
-
_logEvent(callingStatefulLogger, {
|
2475
|
-
name: EventNames.REMOTE_STREAM_STOPPING,
|
2476
|
-
level: 'info',
|
2477
|
-
message: 'Remote stream is still rendering. Changing status to stopping.',
|
2478
|
-
data: streamLogInfo
|
2479
|
-
});
|
2480
|
-
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Stopping', undefined);
|
2481
|
-
return;
|
2530
|
+
_logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);
|
2531
|
+
if (streamEventType === 'disposeViewRemote' && participantKey) {
|
2532
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);
|
2482
2533
|
}
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
_logEvent(callingStatefulLogger, {
|
2487
|
-
name: EventNames.DISPOSING_REMOTE_RENDERER,
|
2488
|
-
level: 'info',
|
2489
|
-
message: 'Disposing remote view renderer.',
|
2490
|
-
data: streamLogInfo
|
2491
|
-
});
|
2492
|
-
renderInfo.renderer.dispose();
|
2493
|
-
}
|
2494
|
-
else {
|
2495
|
-
_logEvent(callingStatefulLogger, {
|
2496
|
-
name: EventNames.REMOTE_RENDERER_NOT_FOUND,
|
2497
|
-
level: 'error',
|
2498
|
-
message: 'Cannot find remote view renderer.',
|
2499
|
-
data: streamLogInfo
|
2500
|
-
});
|
2501
|
-
}
|
2502
|
-
}
|
2503
|
-
function disposeViewLocalVideo(context, internalContext, callId) {
|
2504
|
-
const renderInfo = internalContext.getLocalRenderInfo(callId);
|
2505
|
-
const streamType = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.stream.mediaStreamType;
|
2506
|
-
const streamLogInfo = { callId, streamType };
|
2507
|
-
_logEvent(callingStatefulLogger, {
|
2508
|
-
name: EventNames.START_DISPOSE_LOCAL_STREAM,
|
2509
|
-
level: 'info',
|
2510
|
-
message: 'Start disposing local stream.',
|
2511
|
-
data: streamLogInfo
|
2512
|
-
});
|
2534
|
+
const renderInfo = streamEventType === 'disposeViewRemote' && participantKey
|
2535
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)
|
2536
|
+
: internalContext.getLocalRenderInfo(callId);
|
2513
2537
|
if (!renderInfo) {
|
2514
|
-
|
2515
|
-
name: EventNames.LOCAL_DISPOSE_INFO_NOT_FOUND,
|
2516
|
-
level: 'error',
|
2517
|
-
message: 'Cannot find render info when disposing local stream.',
|
2518
|
-
data: streamLogInfo
|
2519
|
-
});
|
2538
|
+
_logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);
|
2520
2539
|
return;
|
2521
2540
|
}
|
2522
2541
|
// Nothing to dispose of or clean up -- we can safely exit early here.
|
2523
2542
|
if (renderInfo.status === 'NotRendered') {
|
2524
|
-
|
2525
|
-
name: EventNames.LOCAL_STREAM_ALREADY_DISPOSED,
|
2526
|
-
level: 'info',
|
2527
|
-
message: 'LocalVideoStream is already disposed.',
|
2528
|
-
data: streamLogInfo
|
2529
|
-
});
|
2543
|
+
_logStreamEvent(EventNames.STREAM_ALREADY_DISPOSED, streamLogInfo);
|
2530
2544
|
return;
|
2531
2545
|
}
|
2532
2546
|
// Status is already marked as "stopping" so we can exit early here. This is because stopping only occurs
|
2533
2547
|
// when the stream is being created in createView but hasn't been completed being created yet. The createView
|
2534
2548
|
// method will see the "stopping" status and perform the cleanup
|
2535
2549
|
if (renderInfo.status === 'Stopping') {
|
2536
|
-
|
2537
|
-
name: EventNames.LOCAL_STREAM_STOPPING,
|
2538
|
-
level: 'info',
|
2539
|
-
message: 'Local stream is already stopping.',
|
2540
|
-
data: streamLogInfo
|
2541
|
-
});
|
2550
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
2542
2551
|
return;
|
2543
2552
|
}
|
2544
2553
|
// If the stream is in the middle of being rendered (i.e. has state "Rendering"), we need the status as
|
2545
2554
|
// "stopping" without performing any cleanup. This will tell the `createView` method that it should stop
|
2546
2555
|
// rendering and clean up the state once the view has finished being created.
|
2547
2556
|
if (renderInfo.status === 'Rendering') {
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
data: streamLogInfo
|
2553
|
-
});
|
2554
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', renderInfo.renderer);
|
2557
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
2558
|
+
streamEventType === 'disposeViewRemote' && participantKey
|
2559
|
+
? internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'Stopping', undefined)
|
2560
|
+
: internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', renderInfo.renderer);
|
2555
2561
|
return;
|
2556
2562
|
}
|
2557
2563
|
if (renderInfo.renderer) {
|
2558
|
-
|
2559
|
-
name: EventNames.DISPOSING_LOCAL_RENDERER,
|
2560
|
-
level: 'info',
|
2561
|
-
message: 'Disposing local view renderer.',
|
2562
|
-
data: streamLogInfo
|
2563
|
-
});
|
2564
|
+
_logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);
|
2564
2565
|
renderInfo.renderer.dispose();
|
2565
|
-
//
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2566
|
+
// Else the state must be in the "Rendered" state, so we can dispose the renderer and clean up the state.
|
2567
|
+
if (streamEventType === 'disposeViewRemote' && participantKey) {
|
2568
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, streamId, renderInfo.stream, 'NotRendered', undefined);
|
2569
|
+
}
|
2570
|
+
else if (streamEventType === 'disposeViewLocal') {
|
2571
|
+
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
2572
|
+
context.setLocalVideoStreamRendererView(callId, undefined);
|
2573
|
+
}
|
2569
2574
|
}
|
2570
2575
|
else {
|
2571
|
-
|
2572
|
-
name: EventNames.LOCAL_RENDERER_NOT_FOUND,
|
2573
|
-
level: 'error',
|
2574
|
-
message: 'Cannot find renderer when disposing local stream.',
|
2575
|
-
data: streamLogInfo
|
2576
|
-
});
|
2576
|
+
_logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);
|
2577
2577
|
}
|
2578
2578
|
}
|
2579
2579
|
function disposeViewUnparentedVideo(context, internalContext, stream) {
|
2580
2580
|
const streamType = stream.mediaStreamType;
|
2581
|
-
const streamLogInfo = { streamType };
|
2582
|
-
|
2583
|
-
name: EventNames.START_DISPOSE_LOCAL_STREAM,
|
2584
|
-
level: 'info',
|
2585
|
-
message: 'Start disposing unparented local stream.',
|
2586
|
-
data: streamLogInfo
|
2587
|
-
});
|
2581
|
+
const streamLogInfo = { streamType, streamEventType: 'disposeViewUnparented' };
|
2582
|
+
_logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);
|
2588
2583
|
context.deleteDeviceManagerUnparentedView(stream);
|
2589
2584
|
const renderInfo = internalContext.getUnparentedRenderInfo(stream);
|
2590
2585
|
if (!renderInfo) {
|
2591
|
-
|
2592
|
-
name: EventNames.LOCAL_DISPOSE_INFO_NOT_FOUND,
|
2593
|
-
level: 'error',
|
2594
|
-
message: 'Cannot find render info when disposing unparented local stream.',
|
2595
|
-
data: streamLogInfo
|
2596
|
-
});
|
2586
|
+
_logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);
|
2597
2587
|
return;
|
2598
2588
|
}
|
2599
2589
|
if (renderInfo.status === 'Rendering') {
|
2600
|
-
|
2601
|
-
name: EventNames.LOCAL_STREAM_STOPPING,
|
2602
|
-
level: 'info',
|
2603
|
-
message: 'Unparented local stream is still rendering. Changing status to stopping.',
|
2604
|
-
data: streamLogInfo
|
2605
|
-
});
|
2590
|
+
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
2606
2591
|
internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);
|
2607
2592
|
}
|
2608
2593
|
else {
|
2609
2594
|
internalContext.deleteUnparentedRenderInfo(stream);
|
2610
2595
|
}
|
2611
2596
|
if (renderInfo.renderer) {
|
2612
|
-
|
2613
|
-
name: EventNames.DISPOSING_LOCAL_RENDERER,
|
2614
|
-
level: 'info',
|
2615
|
-
message: 'Disposing unparented local view renderer.',
|
2616
|
-
data: streamLogInfo
|
2617
|
-
});
|
2597
|
+
_logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);
|
2618
2598
|
renderInfo.renderer.dispose();
|
2619
2599
|
}
|
2620
2600
|
else {
|
2621
|
-
|
2622
|
-
name: EventNames.LOCAL_RENDERER_NOT_FOUND,
|
2623
|
-
level: 'error',
|
2624
|
-
message: 'Cannot find renderer when disposing unparented local stream.',
|
2625
|
-
data: streamLogInfo
|
2626
|
-
});
|
2601
|
+
_logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);
|
2627
2602
|
}
|
2628
2603
|
}
|
2629
2604
|
/**
|
@@ -2631,13 +2606,8 @@ function disposeViewUnparentedVideo(context, internalContext, stream) {
|
|
2631
2606
|
*/
|
2632
2607
|
function createView(context, internalContext, callId, participantId, stream, options) {
|
2633
2608
|
const streamType = stream.mediaStreamType;
|
2634
|
-
if (
|
2635
|
-
|
2636
|
-
return createViewRemoteVideo(context, internalContext, callId, participantId, stream, options);
|
2637
|
-
}
|
2638
|
-
else if (!('id' in stream) && callId) {
|
2639
|
-
// Render LocalVideoStream that is part of a Call
|
2640
|
-
return createViewLocalVideo(context, internalContext, callId, options);
|
2609
|
+
if (callId) {
|
2610
|
+
return createViewVideo(context, internalContext, callId, stream, participantId, options);
|
2641
2611
|
}
|
2642
2612
|
else if (!('id' in stream) && !callId) {
|
2643
2613
|
// Render LocalVideoStream that is not part of a Call
|
@@ -2646,12 +2616,7 @@ function createView(context, internalContext, callId, participantId, stream, opt
|
|
2646
2616
|
return context.withAsyncErrorTeedToState(() => __awaiter$y(this, void 0, void 0, function* () { return yield createViewUnparentedVideo(context, internalContext, stream, options); }), 'Call.startVideo')();
|
2647
2617
|
}
|
2648
2618
|
else {
|
2649
|
-
|
2650
|
-
name: EventNames.CREATE_STREAM_INVALID_PARAMS,
|
2651
|
-
level: 'warning',
|
2652
|
-
message: 'Create View invalid combination of parameters.',
|
2653
|
-
data: { streamType }
|
2654
|
-
});
|
2619
|
+
_logStreamEvent(EventNames.CREATE_STREAM_INVALID_PARAMS, { streamType });
|
2655
2620
|
return Promise.resolve(undefined);
|
2656
2621
|
}
|
2657
2622
|
}
|
@@ -2660,13 +2625,8 @@ function createView(context, internalContext, callId, participantId, stream, opt
|
|
2660
2625
|
*/
|
2661
2626
|
function disposeView(context, internalContext, callId, participantId, stream) {
|
2662
2627
|
const streamType = stream.mediaStreamType;
|
2663
|
-
if (
|
2664
|
-
|
2665
|
-
disposeViewRemoteVideo(context, internalContext, callId, participantId, stream);
|
2666
|
-
}
|
2667
|
-
else if (!('id' in stream) && callId) {
|
2668
|
-
// Stop rendering LocalVideoStream that is part of a Call
|
2669
|
-
disposeViewLocalVideo(context, internalContext, callId);
|
2628
|
+
if (callId) {
|
2629
|
+
disposeViewVideo(context, internalContext, callId, stream, participantId);
|
2670
2630
|
}
|
2671
2631
|
else if (!('id' in stream) && !callId) {
|
2672
2632
|
// Stop rendering LocalVideoStream that is not part of a Call
|
@@ -2675,12 +2635,7 @@ function disposeView(context, internalContext, callId, participantId, stream) {
|
|
2675
2635
|
context.withErrorTeedToState(() => disposeViewUnparentedVideo(context, internalContext, stream), 'Call.stopVideo')();
|
2676
2636
|
}
|
2677
2637
|
else {
|
2678
|
-
|
2679
|
-
name: EventNames.DISPOSE_STREAM_INVALID_PARAMS,
|
2680
|
-
level: 'warning',
|
2681
|
-
message: 'Dispose View invalid combination of parameters.',
|
2682
|
-
data: { streamType }
|
2683
|
-
});
|
2638
|
+
_logStreamEvent(EventNames.DISPOSE_STREAM_INVALID_PARAMS, { streamType });
|
2684
2639
|
return;
|
2685
2640
|
}
|
2686
2641
|
}
|
@@ -4368,7 +4323,11 @@ const defaultIdentifiers = {
|
|
4368
4323
|
videoGallery: 'video-gallery',
|
4369
4324
|
videoTile: 'video-tile',
|
4370
4325
|
overflowGalleryLeftNavButton: 'overflow-gallery-left-nav-button',
|
4371
|
-
overflowGalleryRightNavButton: 'overflow-gallery-right-nav-button'
|
4326
|
+
overflowGalleryRightNavButton: 'overflow-gallery-right-nav-button',
|
4327
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
4328
|
+
verticalGalleryVideoTile: 'vertical-gallery-video-tile',
|
4329
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
4330
|
+
verticalGalleryPageCounter: 'vertical-gallery-page-counter'
|
4372
4331
|
};
|
4373
4332
|
/**
|
4374
4333
|
* @private
|
@@ -9632,6 +9591,8 @@ const VerticalGallery = (props) => {
|
|
9632
9591
|
const { children, styles, childrenPerPage } = props;
|
9633
9592
|
const [page, setPage] = React.useState(1);
|
9634
9593
|
const [buttonState, setButtonState] = React.useState({ previous: true, next: true });
|
9594
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
9595
|
+
const ids = useIdentifiers();
|
9635
9596
|
const numberOfChildren = React__default['default'].Children.count(children);
|
9636
9597
|
const lastPage = Math.ceil(numberOfChildren / childrenPerPage);
|
9637
9598
|
const paginatedChildren = React.useMemo(() => {
|
@@ -9675,13 +9636,14 @@ const VerticalGallery = (props) => {
|
|
9675
9636
|
}
|
9676
9637
|
return (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(rootStyle, styles === null || styles === void 0 ? void 0 : styles.root) },
|
9677
9638
|
React__default['default'].createElement(react.Stack, { styles: childContainerStyle }, childrenOnCurrentPage.map((child, i) => {
|
9678
|
-
return (React__default['default'].createElement(react.Stack.Item, { key: i, styles: childrenStyles }, child));
|
9639
|
+
return (React__default['default'].createElement(react.Stack.Item, { key: i, styles: childrenStyles, "data-ui-id": ids.verticalGalleryVideoTile }, child));
|
9679
9640
|
})),
|
9680
9641
|
showButtons && (React__default['default'].createElement(VerticalGalleryControlBar, { buttonsDisabled: buttonState, onPreviousButtonClick: onPreviousButtonClick, onNextButtonClick: onNextButtonClick, totalPages: lastPage, currentPage: page }))));
|
9681
9642
|
};
|
9682
9643
|
const VerticalGalleryControlBar = (props) => {
|
9683
9644
|
const { onNextButtonClick, onPreviousButtonClick, buttonsDisabled, currentPage, totalPages, styles } = props;
|
9684
9645
|
const theme = useTheme();
|
9646
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
9685
9647
|
const ids = useIdentifiers();
|
9686
9648
|
/* @conditional-compile-remove(vertical-gallery) */
|
9687
9649
|
const strings = useLocale$1().strings.VerticalGallery;
|
@@ -9703,7 +9665,9 @@ const VerticalGalleryControlBar = (props) => {
|
|
9703
9665
|
/* @conditional-compile-remove(vertical-gallery) */
|
9704
9666
|
ariaLabel: strings.leftNavButtonAriaLabel, "data-ui-id": ids.overflowGalleryLeftNavButton },
|
9705
9667
|
React__default['default'].createElement(react.Icon, { iconName: "VerticalGalleryLeftButton", styles: navIconStyles })),
|
9706
|
-
React__default['default'].createElement(react.Text
|
9668
|
+
React__default['default'].createElement(react.Text
|
9669
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
9670
|
+
, { "data-ui-id": ids.verticalGalleryPageCounter, className: pageCounterStyles }, `${currentPage} / ${totalPages}`),
|
9707
9671
|
React__default['default'].createElement(react.DefaultButton, { className: nextButtonsStyles, onClick: onNextButtonClick, disabled: buttonsDisabled === null || buttonsDisabled === void 0 ? void 0 : buttonsDisabled.next,
|
9708
9672
|
/* @conditional-compile-remove(vertical-gallery) */
|
9709
9673
|
ariaLabel: strings.rightNavButtonAriaLabel, "data-ui-id": ids.overflowGalleryRightNavButton },
|
@@ -17578,6 +17542,18 @@ const createCompositeHandlers = memoizeOne__default['default']((adapter) => ({
|
|
17578
17542
|
/* @conditional-compile-remove(call-readiness) */
|
17579
17543
|
askDevicePermission: (constrain) => __awaiter$b(void 0, void 0, void 0, function* () {
|
17580
17544
|
return adapter.askDevicePermission(constrain);
|
17545
|
+
}),
|
17546
|
+
/* @conditional-compile-remove(video-background-effects) */
|
17547
|
+
onRemoveVideoBackgroundEffects: () => __awaiter$b(void 0, void 0, void 0, function* () {
|
17548
|
+
throw new Error('Not implemented');
|
17549
|
+
}),
|
17550
|
+
/* @conditional-compile-remove(video-background-effects) */
|
17551
|
+
onBlurVideoBackground: () => __awaiter$b(void 0, void 0, void 0, function* () {
|
17552
|
+
throw new Error('Not implemented');
|
17553
|
+
}),
|
17554
|
+
/* @conditional-compile-remove(video-background-effects) */
|
17555
|
+
onReplaceVideoBackground: () => __awaiter$b(void 0, void 0, void 0, function* () {
|
17556
|
+
throw new Error('Not implemented');
|
17581
17557
|
})
|
17582
17558
|
}));
|
17583
17559
|
|