@azure/communication-react 1.11.0-alpha-202312060012 → 1.11.0-alpha-202312080012
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 +66 -63
- package/dist/dist-cjs/communication-react/index.js +203 -124
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetry.js +3 -1
- package/dist/dist-esm/acs-ui-common/src/telemetry.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/getRemoteParticipantsExcludingConsumers.d.ts +1 -22
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/handlers/createTeamsCallHandlers.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/utils/callUtils.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +2 -2
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +2 -2
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +22 -7
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +23 -45
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.d.ts +9 -11
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js +28 -13
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +2 -2
- package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js +52 -40
- package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/StreamUtilsLogging.d.ts +1 -1
- package/dist/dist-esm/calling-stateful-client/src/StreamUtilsLogging.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/StatefulChatClient.d.ts +3 -3
- package/dist/dist-esm/chat-stateful-client/src/convertChatMessage.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.d.ts +1 -1
- package/dist/dist-esm/communication-react/src/mergedHooks.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/DevicesButton.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileCard.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/LocalVideoCameraButton.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/LocalVideoCameraButton.js +2 -2
- package/dist/dist-esm/react-components/src/components/LocalVideoCameraButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/LocalVideoTile.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +8 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +14 -0
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.js +3 -3
- package/dist/dist-esm/react-components/src/components/styles/VideoGallery.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/utils/getParticipantsWhoHaveReadMessage.d.ts +4 -4
- package/dist/dist-esm/react-components/src/components/utils/keyboardNavigation.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/utils.d.ts +1 -1
- package/dist/dist-esm/react-components/src/theming/v9ThemeShim.d.ts +1 -1
- package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js +1 -1
- package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LobbyTile.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LobbyTile.js +8 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LobbyTile.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +1 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/LocalVideoTileSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/activeVideoBackgroundEffectSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/callStatusSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/capabilitiesChangedInfoAndRoleSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/complianceBannerSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/deviceCountSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/devicePermissionSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/dominantRemoteParticipantSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/lobbySelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localAndRemotePIPSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localPreviewSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/localVideoStreamSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mediaGallerySelector.d.ts +2 -46
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/mutedNotificationSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/networkReconnectTileSelector.d.ts +1 -23
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js +3 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallPage.styles.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LobbyTile.styles.d.ts +5 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LobbyTile.styles.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LobbyTile.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +9 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +8 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/useConsoleErrors.d.ts +6 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/useConsoleErrors.js +31 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/useConsoleErrors.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +6 -6
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatHeader.d.ts +3 -10
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +1 -8
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.styles.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.d.ts +4 -4
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ConvertContextualMenuItemToDrawerMenuItem.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +45 -45
- package/dist/dist-esm/react-composites/src/composites/common/styles/Pane.styles.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/utils.d.ts +1 -1
- package/package.json +1 -1
@@ -31,20 +31,27 @@ function createViewVideo(context, internalContext, callId, stream, participantId
|
|
31
31
|
streamEventType = 'createViewUnparented';
|
32
32
|
}
|
33
33
|
const streamType = stream === null || stream === void 0 ? void 0 : stream.mediaStreamType;
|
34
|
-
const
|
34
|
+
const localStreamKey = stream.mediaStreamType;
|
35
|
+
const remoteStreamId = stream.id;
|
35
36
|
// 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
37
|
const participantKey = streamEventType === 'createViewRemote' && participantId
|
37
38
|
? typeof participantId === 'string'
|
38
39
|
? participantId
|
39
40
|
: toFlatCommunicationIdentifier(participantId)
|
40
41
|
: undefined;
|
41
|
-
const streamLogInfo = {
|
42
|
+
const streamLogInfo = {
|
43
|
+
callId,
|
44
|
+
participantKey,
|
45
|
+
streamId: remoteStreamId !== null && remoteStreamId !== void 0 ? remoteStreamId : localStreamKey,
|
46
|
+
streamType,
|
47
|
+
streamEventType
|
48
|
+
};
|
42
49
|
// make different logging announcement based on whether or not we are starting a local or remote
|
43
50
|
_logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);
|
44
51
|
// if we have a participant Id and a stream get the remote info, else get the local render info from state.
|
45
52
|
const renderInfo = streamEventType === 'createViewRemote' && participantKey
|
46
|
-
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey,
|
47
|
-
: internalContext.getLocalRenderInfo(callId);
|
53
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId)
|
54
|
+
: internalContext.getLocalRenderInfo(callId, localStreamKey);
|
48
55
|
if (!renderInfo) {
|
49
56
|
_logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);
|
50
57
|
return;
|
@@ -64,18 +71,18 @@ function createViewVideo(context, internalContext, callId, stream, participantId
|
|
64
71
|
if (renderInfo.status === 'Stopping') {
|
65
72
|
if (streamEventType === 'createViewRemote' && participantKey) {
|
66
73
|
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
67
|
-
internalContext.setRemoteRenderInfo(callId, participantKey,
|
74
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
68
75
|
}
|
69
76
|
else if (streamEventType === 'createViewLocal') {
|
70
77
|
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
71
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
78
|
+
internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Rendering', renderInfo.renderer);
|
72
79
|
}
|
73
80
|
return;
|
74
81
|
}
|
75
82
|
const renderer = new VideoStreamRenderer(renderInfo.stream);
|
76
83
|
streamEventType === 'createViewRemote' && participantKey
|
77
|
-
? internalContext.setRemoteRenderInfo(callId, participantKey,
|
78
|
-
: internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Rendering', renderer);
|
84
|
+
? internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Rendering', undefined)
|
85
|
+
: internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Rendering', renderer);
|
79
86
|
let view;
|
80
87
|
try {
|
81
88
|
view = yield renderer.createView(options);
|
@@ -83,27 +90,27 @@ function createViewVideo(context, internalContext, callId, stream, participantId
|
|
83
90
|
catch (e) {
|
84
91
|
if (streamEventType === 'createViewRemote' && participantKey) {
|
85
92
|
_logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);
|
86
|
-
internalContext.setRemoteRenderInfo(callId, participantKey,
|
93
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'NotRendered', undefined);
|
87
94
|
}
|
88
95
|
else if (streamEventType === 'createViewLocal') {
|
89
96
|
_logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);
|
90
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
97
|
+
internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'NotRendered', undefined);
|
91
98
|
}
|
92
99
|
throw e;
|
93
100
|
}
|
94
101
|
// Since render could take some time, we need to check if the stream is still valid and if we received a signal to
|
95
102
|
// stop rendering.
|
96
103
|
const refreshedRenderInfo = streamEventType === 'createViewRemote' && participantKey
|
97
|
-
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey,
|
98
|
-
: internalContext.getLocalRenderInfo(callId);
|
104
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId)
|
105
|
+
: internalContext.getLocalRenderInfo(callId, localStreamKey);
|
99
106
|
if (!refreshedRenderInfo) {
|
100
107
|
// RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer
|
101
108
|
// and clean up the state.
|
102
109
|
_logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);
|
103
110
|
renderer.dispose();
|
104
111
|
streamEventType === 'createViewRemote' && participantKey
|
105
|
-
? context.setRemoteVideoStreamRendererView(callId, participantKey,
|
106
|
-
: context.setLocalVideoStreamRendererView(callId, undefined);
|
112
|
+
? context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined)
|
113
|
+
: context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);
|
107
114
|
return;
|
108
115
|
}
|
109
116
|
if (refreshedRenderInfo.status === 'Stopping') {
|
@@ -113,25 +120,25 @@ function createViewVideo(context, internalContext, callId, stream, participantId
|
|
113
120
|
_logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);
|
114
121
|
renderer.dispose();
|
115
122
|
if (streamEventType === 'createViewRemote' && participantKey) {
|
116
|
-
internalContext.setRemoteRenderInfo(callId, participantKey,
|
117
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey,
|
123
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
124
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);
|
118
125
|
}
|
119
126
|
else if (streamEventType === 'createViewLocal') {
|
120
|
-
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
121
|
-
context.setLocalVideoStreamRendererView(callId, undefined);
|
127
|
+
internalContext.setLocalRenderInfo(callId, localStreamKey, refreshedRenderInfo.stream, 'NotRendered', undefined);
|
128
|
+
context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);
|
122
129
|
}
|
123
130
|
return;
|
124
131
|
}
|
125
132
|
// Else the stream still exists and status is not telling us to stop rendering. Complete the render process by
|
126
133
|
// updating the state.
|
127
134
|
if (streamEventType === 'createViewRemote' && participantKey) {
|
128
|
-
internalContext.setRemoteRenderInfo(callId, participantKey,
|
129
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey,
|
135
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
136
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
130
137
|
_logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);
|
131
138
|
}
|
132
139
|
else if (streamEventType === 'createViewLocal') {
|
133
|
-
internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream, 'Rendered', renderer);
|
134
|
-
context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
140
|
+
internalContext.setLocalRenderInfo(callId, localStreamKey, refreshedRenderInfo.stream, 'Rendered', renderer);
|
141
|
+
context.setLocalVideoStreamRendererView(callId, localStreamKey, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
135
142
|
_logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);
|
136
143
|
}
|
137
144
|
return {
|
@@ -215,21 +222,22 @@ function disposeViewVideo(context, internalContext, callId, stream, participantI
|
|
215
222
|
streamEventType = 'disposeViewUnparented';
|
216
223
|
}
|
217
224
|
const streamType = stream.mediaStreamType;
|
218
|
-
const
|
225
|
+
const localStreamKey = stream.mediaStreamType;
|
226
|
+
const remoteStreamId = stream.id;
|
219
227
|
// 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
228
|
const participantKey = streamEventType === 'disposeViewRemote' && participantId
|
221
229
|
? typeof participantId === 'string'
|
222
230
|
? participantId
|
223
231
|
: toFlatCommunicationIdentifier(participantId)
|
224
232
|
: undefined;
|
225
|
-
const streamLogInfo = { callId, participantKey, streamId, streamType };
|
233
|
+
const streamLogInfo = { callId, participantKey, streamId: remoteStreamId !== null && remoteStreamId !== void 0 ? remoteStreamId : localStreamKey, streamType };
|
226
234
|
_logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);
|
227
235
|
if (streamEventType === 'disposeViewRemote' && participantKey) {
|
228
|
-
context.setRemoteVideoStreamRendererView(callId, participantKey,
|
236
|
+
context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);
|
229
237
|
}
|
230
238
|
const renderInfo = streamEventType === 'disposeViewRemote' && participantKey
|
231
|
-
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey,
|
232
|
-
: internalContext.getLocalRenderInfo(callId);
|
239
|
+
? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId)
|
240
|
+
: internalContext.getLocalRenderInfo(callId, localStreamKey);
|
233
241
|
if (!renderInfo) {
|
234
242
|
_logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);
|
235
243
|
return;
|
@@ -252,8 +260,8 @@ function disposeViewVideo(context, internalContext, callId, stream, participantI
|
|
252
260
|
if (renderInfo.status === 'Rendering') {
|
253
261
|
_logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);
|
254
262
|
streamEventType === 'disposeViewRemote' && participantKey
|
255
|
-
? internalContext.setRemoteRenderInfo(callId, participantKey,
|
256
|
-
: internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'Stopping', renderInfo.renderer);
|
263
|
+
? internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'Stopping', undefined)
|
264
|
+
: internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'Stopping', renderInfo.renderer);
|
257
265
|
return;
|
258
266
|
}
|
259
267
|
if (renderInfo.renderer) {
|
@@ -261,11 +269,11 @@ function disposeViewVideo(context, internalContext, callId, stream, participantI
|
|
261
269
|
renderInfo.renderer.dispose();
|
262
270
|
// Else the state must be in the "Rendered" state, so we can dispose the renderer and clean up the state.
|
263
271
|
if (streamEventType === 'disposeViewRemote' && participantKey) {
|
264
|
-
internalContext.setRemoteRenderInfo(callId, participantKey,
|
272
|
+
internalContext.setRemoteRenderInfo(callId, participantKey, remoteStreamId, renderInfo.stream, 'NotRendered', undefined);
|
265
273
|
}
|
266
274
|
else if (streamEventType === 'disposeViewLocal') {
|
267
|
-
internalContext.setLocalRenderInfo(callId, renderInfo.stream, 'NotRendered', undefined);
|
268
|
-
context.setLocalVideoStreamRendererView(callId, undefined);
|
275
|
+
internalContext.setLocalRenderInfo(callId, localStreamKey, renderInfo.stream, 'NotRendered', undefined);
|
276
|
+
context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);
|
269
277
|
}
|
270
278
|
}
|
271
279
|
else {
|
@@ -340,9 +348,9 @@ export function disposeView(context, internalContext, callId, participantId, str
|
|
340
348
|
* Only stops videos that are tied to a Call.
|
341
349
|
*/
|
342
350
|
export function disposeAllViewsFromCall(context, internalContext, callId) {
|
343
|
-
const
|
344
|
-
if (
|
345
|
-
for (const [participantKey, participantStreams] of
|
351
|
+
const remoteStreams = internalContext.getRemoteRenderInfoForCall(callId);
|
352
|
+
if (remoteStreams) {
|
353
|
+
for (const [participantKey, participantStreams] of remoteStreams.entries()) {
|
346
354
|
for (const [_, remoteStreamAndRenderer] of participantStreams.entries()) {
|
347
355
|
// We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to
|
348
356
|
// convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.
|
@@ -350,11 +358,15 @@ export function disposeAllViewsFromCall(context, internalContext, callId) {
|
|
350
358
|
}
|
351
359
|
}
|
352
360
|
}
|
353
|
-
const
|
354
|
-
if (
|
355
|
-
|
356
|
-
|
357
|
-
|
361
|
+
const localStreams = internalContext.getLocalRenderInfosForCall(callId);
|
362
|
+
if (localStreams) {
|
363
|
+
for (const localStreamAndRenderer of localStreams.values()) {
|
364
|
+
if (localStreamAndRenderer && localStreamAndRenderer.renderer) {
|
365
|
+
// We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to
|
366
|
+
// convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.
|
367
|
+
disposeView(context, internalContext, callId, undefined, convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream));
|
368
|
+
}
|
369
|
+
}
|
358
370
|
}
|
359
371
|
}
|
360
372
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"StreamUtils.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/StreamUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAEL,gBAAgB,EAEhB,mBAAmB,EAEpB,MAAM,8BAA8B,CAAC;AAItC,OAAO,EACL,6CAA6C,EAC7C,+CAA+C,EAC/C,kDAAkD,EACnD,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE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AO,EAAE,EAAE;YACxE,KAAK,MAAM,CAAC,CAAC,EAAE,uBAAuB,CAAC,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE;gBACvE,+GAA+G;gBAC/G,+GAA+G;gBAC/G,WAAW,CACT,OAAO,EACP,eAAe,EACf,MAAM,EACN,cAAc,EACd,+CAA+C,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAChF,CAAC;aACH;SACF;KACF;IACD,MAAM,sBAAsB,GAAG,eAAe,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1E,IAAI,sBAAsB,IAAI,sBAAsB,CAAC,QAAQ,EAAE;QAC7D,+GAA+G;QAC/G,+GAA+G;QAC/G,WAAW,CACT,OAAO,EACP,eAAe,EACf,MAAM,EACN,SAAS,EACT,6CAA6C,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAC7E,CAAC;KACH;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAoB,EAAE,eAAoC;IACxF,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,EAAE,CAAC;IAC7C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC3D;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n CreateViewOptions,\n LocalVideoStream,\n RemoteVideoStream,\n VideoStreamRenderer,\n VideoStreamRendererView\n} from '@azure/communication-calling';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport {\n convertSdkLocalStreamToDeclarativeLocalStream,\n convertSdkRemoteStreamToDeclarativeRemoteStream,\n convertFromSDKToDeclarativeVideoStreamRendererView\n} from './Converter';\nimport { InternalCallContext } from './InternalCallContext';\nimport { toFlatCommunicationIdentifier, _logEvent } from '@internal/acs-ui-common';\nimport { EventNames } from './Logger';\nimport { _logStreamEvent } from './StreamUtilsLogging';\n\n/**\n * Return result from {@link StatefulCallClient.createView}.\n *\n * @public\n */\nexport type CreateViewResult = {\n renderer: VideoStreamRenderer;\n view: VideoStreamRendererView;\n};\n\nasync function createViewVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n stream?: RemoteVideoStreamState | LocalVideoStreamState,\n participantId?: CommunicationIdentifierKind | string,\n options?: CreateViewOptions\n): Promise<CreateViewResult | undefined> {\n // we can only have 3 types of createView\n let streamEventType: 'createViewLocal' | 'createViewRemote' | 'createViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'createViewRemote';\n } else if (callId) {\n streamEventType = 'createViewLocal';\n } else {\n // TODO update for when unparented view.\n throw new Error('unparented createView not implemented yet here');\n streamEventType = 'createViewUnparented';\n }\n\n const streamType = stream?.mediaStreamType;\n const streamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey =\n streamEventType === 'createViewRemote' && participantId\n ? typeof participantId === 'string'\n ? participantId\n : toFlatCommunicationIdentifier(participantId)\n : undefined;\n\n const streamLogInfo = { callId, participantKey, streamId, streamType, streamEventType };\n\n // make different logging announcement based on whether or not we are starting a local or remote\n _logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);\n\n // if we have a participant Id and a stream get the remote info, else get the local render info from state.\n const renderInfo =\n streamEventType === 'createViewRemote' && participantKey\n ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)\n : internalContext.getLocalRenderInfo(callId);\n\n if (!renderInfo) {\n _logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);\n return;\n }\n\n if (renderInfo.status === 'Rendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_RENDERED, streamLogInfo);\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n _logStreamEvent(EventNames.STREAM_RENDERING, streamLogInfo);\n return;\n }\n\n // \"Stopping\" only happens if the stream was in \"rendering\" but `disposeView` was called.\n // Now that `createView` has been re-called, we can flip the state back to \"rendering\".\n if (renderInfo.status === 'Stopping') {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n renderInfo.stream as RemoteVideoStream,\n 'Rendering',\n renderInfo.renderer\n );\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setLocalRenderInfo(\n callId,\n renderInfo.stream as LocalVideoStream,\n 'Rendering',\n renderInfo.renderer\n );\n }\n return;\n }\n\n const renderer = new VideoStreamRenderer(renderInfo.stream);\n\n streamEventType === 'createViewRemote' && participantKey\n ? internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n renderInfo.stream as RemoteVideoStream,\n 'Rendering',\n undefined\n )\n : internalContext.setLocalRenderInfo(callId, renderInfo.stream as LocalVideoStream, 'Rendering', renderer);\n\n let view;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n renderInfo.stream as RemoteVideoStream,\n 'NotRendered',\n undefined\n );\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);\n internalContext.setLocalRenderInfo(callId, renderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n }\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo =\n streamEventType === 'createViewRemote' && participantKey\n ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)\n : internalContext.getLocalRenderInfo(callId);\n\n if (!refreshedRenderInfo) {\n // RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer\n // and clean up the state.\n _logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);\n renderer.dispose();\n streamEventType === 'createViewRemote' && participantKey\n ? context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined)\n : context.setLocalVideoStreamRendererView(callId, undefined);\n return;\n }\n\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state.\n streamEventType === 'createViewRemote';\n _logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);\n renderer.dispose();\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n refreshedRenderInfo.stream as RemoteVideoStream,\n 'NotRendered',\n undefined\n );\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(\n callId,\n refreshedRenderInfo.stream as LocalVideoStream,\n 'NotRendered',\n undefined\n );\n context.setLocalVideoStreamRendererView(callId, undefined);\n }\n return;\n }\n\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n refreshedRenderInfo.stream as RemoteVideoStream,\n 'Rendered',\n renderer\n );\n context.setRemoteVideoStreamRendererView(\n callId,\n participantKey,\n streamId,\n convertFromSDKToDeclarativeVideoStreamRendererView(view)\n );\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(callId, refreshedRenderInfo.stream as LocalVideoStream, 'Rendered', renderer);\n context.setLocalVideoStreamRendererView(callId, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n }\n\n return {\n renderer,\n view\n };\n}\n\nasync function createViewUnparentedVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n stream: LocalVideoStreamState,\n options?: CreateViewOptions\n): Promise<CreateViewResult | undefined> {\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n\n if (renderInfo && renderInfo.status === 'Rendered') {\n console.warn('Unparented LocalVideoStream is already rendered');\n return;\n }\n\n if (renderInfo && renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n return;\n }\n\n if (renderInfo && renderInfo.status === 'Stopping') {\n console.warn('Unparented LocalVideoStream is in the middle of stopping');\n return;\n }\n\n const localVideoStream = new LocalVideoStream(stream.source);\n const renderer = new VideoStreamRenderer(localVideoStream);\n\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendering', undefined);\n\n let view: VideoStreamRendererView;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n // Special case for unparented views. Since they are not tied to anything and created by us based on the calls to\n // this function we'll delete it to clean up the data since keeping it around doesn't help us and if developer wants\n // to create a new view they can check that the view is not rendered and call this function again.\n internalContext.deleteUnparentedRenderInfo(stream);\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!refreshedRenderInfo) {\n // Unparented stream's RenderInfo was deleted. Currently this shouldn't happen but if it does we'll just dispose the\n // renderer and clean up state. If developer wanted the stream they could call this function again and that should\n // generate new working state via this function.\n renderer.dispose();\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state. Special case for unparented views, delete them from state when stopped to free up\n // the memory since we were the ones generating this and not tied to any Call state.\n internalContext.deleteUnparentedRenderInfo(stream);\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendered', renderer);\n internalContext.subscribeToUnparentedViewVideoEffects(localVideoStream, context);\n context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n\n return {\n renderer,\n view\n };\n}\n\nfunction disposeViewVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n stream: RemoteVideoStreamState | LocalVideoStreamState,\n participantId?: CommunicationIdentifierKind | string\n): void {\n // we can only have 3 types of createView\n let streamEventType: 'disposeViewLocal' | 'disposeViewRemote' | 'disposeViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'disposeViewRemote';\n } else if (callId) {\n streamEventType = 'disposeViewLocal';\n } else {\n // TODO update for when unparented view.\n streamEventType = 'disposeViewUnparented';\n }\n\n const streamType = stream.mediaStreamType;\n const streamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey =\n streamEventType === 'disposeViewRemote' && participantId\n ? typeof participantId === 'string'\n ? participantId\n : toFlatCommunicationIdentifier(participantId)\n : undefined;\n const streamLogInfo = { callId, participantKey, streamId, streamType };\n\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n context.setRemoteVideoStreamRendererView(callId, participantKey, streamId, undefined);\n }\n\n const renderInfo =\n streamEventType === 'disposeViewRemote' && participantKey\n ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, streamId)\n : internalContext.getLocalRenderInfo(callId);\n\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n\n // Nothing to dispose of or clean up -- we can safely exit early here.\n if (renderInfo.status === 'NotRendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_DISPOSED, streamLogInfo);\n return;\n }\n\n // Status is already marked as \"stopping\" so we can exit early here. This is because stopping only occurs\n // when the stream is being created in createView but hasn't been completed being created yet. The createView\n // method will see the \"stopping\" status and perform the cleanup\n if (renderInfo.status === 'Stopping') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n return;\n }\n\n // If the stream is in the middle of being rendered (i.e. has state \"Rendering\"), we need the status as\n // \"stopping\" without performing any cleanup. This will tell the `createView` method that it should stop\n // rendering and clean up the state once the view has finished being created.\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n streamEventType === 'disposeViewRemote' && participantKey\n ? internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n renderInfo.stream as RemoteVideoStream,\n 'Stopping',\n undefined\n )\n : internalContext.setLocalRenderInfo(\n callId,\n renderInfo.stream as LocalVideoStream,\n 'Stopping',\n renderInfo.renderer\n );\n return;\n }\n\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n // Else the state must be in the \"Rendered\" state, so we can dispose the renderer and clean up the state.\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n streamId,\n renderInfo.stream as RemoteVideoStream,\n 'NotRendered',\n undefined\n );\n } else if (streamEventType === 'disposeViewLocal') {\n internalContext.setLocalRenderInfo(callId, renderInfo.stream as LocalVideoStream, 'NotRendered', undefined);\n context.setLocalVideoStreamRendererView(callId, undefined);\n }\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\n\nfunction disposeViewUnparentedVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n stream: LocalVideoStreamState\n): void {\n const streamType = stream.mediaStreamType;\n const streamLogInfo = { streamType, streamEventType: 'disposeViewUnparented' };\n\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n\n context.deleteDeviceManagerUnparentedView(stream);\n\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.deleteUnparentedRenderInfo(stream);\n }\n\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\n\n/**\n * @private\n */\nexport function createView(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState,\n options?: CreateViewOptions\n): Promise<CreateViewResult | undefined> {\n const streamType = stream.mediaStreamType;\n\n if (callId) {\n return createViewVideo(context, internalContext, callId, stream, participantId, options);\n } else if (!('id' in stream) && !callId) {\n // Render LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a startLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n return context.withAsyncErrorTeedToState(\n async () => await createViewUnparentedVideo(context, internalContext, stream, options),\n 'Call.startVideo'\n )();\n } else {\n _logStreamEvent(EventNames.CREATE_STREAM_INVALID_PARAMS, { streamType });\n return Promise.resolve(undefined);\n }\n}\n\n/**\n * @private\n */\nexport function disposeView(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState\n): void {\n const streamType = stream.mediaStreamType;\n if (callId) {\n disposeViewVideo(context, internalContext, callId, stream, participantId);\n } else if (!('id' in stream) && !callId) {\n // Stop rendering LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a stopLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n context.withErrorTeedToState(\n () => disposeViewUnparentedVideo(context, internalContext, stream),\n 'Call.stopVideo'\n )();\n } else {\n _logStreamEvent(EventNames.DISPOSE_STREAM_INVALID_PARAMS, { streamType });\n return;\n }\n}\n\n/**\n * @private\n * Only stops videos that are tied to a Call.\n */\nexport function disposeAllViewsFromCall(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string\n): void {\n const callStreams = internalContext.getRemoteRenderInfoForCall(callId);\n if (callStreams) {\n for (const [participantKey, participantStreams] of callStreams.entries()) {\n for (const [_, remoteStreamAndRenderer] of participantStreams.entries()) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(\n context,\n internalContext,\n callId,\n participantKey,\n convertSdkRemoteStreamToDeclarativeRemoteStream(remoteStreamAndRenderer.stream)\n );\n }\n }\n }\n const localStreamAndRenderer = internalContext.getLocalRenderInfo(callId);\n if (localStreamAndRenderer && localStreamAndRenderer.renderer) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(\n context,\n internalContext,\n callId,\n undefined,\n convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream)\n );\n }\n}\n\n/**\n * @private\n */\nexport function disposeAllViews(context: CallContext, internalContext: InternalCallContext): void {\n const callIds = internalContext.getCallIds();\n for (const callId of callIds) {\n disposeAllViewsFromCall(context, internalContext, callId);\n }\n}\n\"../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"StreamUtils.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/StreamUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OA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EAAE,CAAC;IAC7C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC3D;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n CreateViewOptions,\n LocalVideoStream,\n RemoteVideoStream,\n VideoStreamRenderer,\n VideoStreamRendererView\n} from '@azure/communication-calling';\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { LocalVideoStreamState, RemoteVideoStreamState } from './CallClientState';\nimport { CallContext } from './CallContext';\nimport {\n convertSdkLocalStreamToDeclarativeLocalStream,\n convertSdkRemoteStreamToDeclarativeRemoteStream,\n convertFromSDKToDeclarativeVideoStreamRendererView\n} from './Converter';\nimport { InternalCallContext } from './InternalCallContext';\nimport { toFlatCommunicationIdentifier, _logEvent } from '@internal/acs-ui-common';\nimport { EventNames } from './Logger';\nimport { _logStreamEvent } from './StreamUtilsLogging';\n\n/**\n * Return result from {@link StatefulCallClient.createView}.\n *\n * @public\n */\nexport type CreateViewResult = {\n renderer: VideoStreamRenderer;\n view: VideoStreamRendererView;\n};\n\nasync function createViewVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n stream?: RemoteVideoStreamState | LocalVideoStreamState,\n participantId?: CommunicationIdentifierKind | string,\n options?: CreateViewOptions\n): Promise<CreateViewResult | undefined> {\n // we can only have 3 types of createView\n let streamEventType: 'createViewLocal' | 'createViewRemote' | 'createViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'createViewRemote';\n } else if (callId) {\n streamEventType = 'createViewLocal';\n } else {\n // TODO update for when unparented view.\n throw new Error('unparented createView not implemented yet here');\n streamEventType = 'createViewUnparented';\n }\n\n const streamType = stream?.mediaStreamType;\n const localStreamKey = (stream as LocalVideoStream).mediaStreamType;\n const remoteStreamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey =\n streamEventType === 'createViewRemote' && participantId\n ? typeof participantId === 'string'\n ? participantId\n : toFlatCommunicationIdentifier(participantId)\n : undefined;\n\n const streamLogInfo = {\n callId,\n participantKey,\n streamId: remoteStreamId ?? localStreamKey,\n streamType,\n streamEventType\n };\n\n // make different logging announcement based on whether or not we are starting a local or remote\n _logStreamEvent(EventNames.CREATING_VIEW, streamLogInfo);\n\n // if we have a participant Id and a stream get the remote info, else get the local render info from state.\n const renderInfo =\n streamEventType === 'createViewRemote' && participantKey\n ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId)\n : internalContext.getLocalRenderInfo(callId, localStreamKey);\n\n if (!renderInfo) {\n _logStreamEvent(EventNames.STREAM_NOT_FOUND, streamLogInfo);\n return;\n }\n\n if (renderInfo.status === 'Rendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_RENDERED, streamLogInfo);\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n _logStreamEvent(EventNames.STREAM_RENDERING, streamLogInfo);\n return;\n }\n\n // \"Stopping\" only happens if the stream was in \"rendering\" but `disposeView` was called.\n // Now that `createView` has been re-called, we can flip the state back to \"rendering\".\n if (renderInfo.status === 'Stopping') {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n renderInfo.stream as RemoteVideoStream,\n 'Rendering',\n renderInfo.renderer\n );\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n renderInfo.stream as LocalVideoStream,\n 'Rendering',\n renderInfo.renderer\n );\n }\n return;\n }\n\n const renderer = new VideoStreamRenderer(renderInfo.stream);\n\n streamEventType === 'createViewRemote' && participantKey\n ? internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n renderInfo.stream as RemoteVideoStream,\n 'Rendering',\n undefined\n )\n : internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n renderInfo.stream as LocalVideoStream,\n 'Rendering',\n renderer\n );\n\n let view;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n if (streamEventType === 'createViewRemote' && participantKey) {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo);\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n renderInfo.stream as RemoteVideoStream,\n 'NotRendered',\n undefined\n );\n } else if (streamEventType === 'createViewLocal') {\n _logStreamEvent(EventNames.CREATE_STREAM_FAIL, streamLogInfo, e);\n internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n renderInfo.stream as LocalVideoStream,\n 'NotRendered',\n undefined\n );\n }\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo =\n streamEventType === 'createViewRemote' && participantKey\n ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId)\n : internalContext.getLocalRenderInfo(callId, localStreamKey);\n\n if (!refreshedRenderInfo) {\n // RenderInfo was removed. This should not happen unless stream was removed from the call so dispose the renderer\n // and clean up the state.\n _logStreamEvent(EventNames.RENDER_INFO_NOT_FOUND, streamLogInfo);\n renderer.dispose();\n streamEventType === 'createViewRemote' && participantKey\n ? context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined)\n : context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n return;\n }\n\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state.\n streamEventType === 'createViewRemote';\n _logStreamEvent(EventNames.CREATED_STREAM_STOPPING, streamLogInfo);\n renderer.dispose();\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n refreshedRenderInfo.stream as RemoteVideoStream,\n 'NotRendered',\n undefined\n );\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n refreshedRenderInfo.stream as LocalVideoStream,\n 'NotRendered',\n undefined\n );\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n return;\n }\n\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n if (streamEventType === 'createViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n refreshedRenderInfo.stream as RemoteVideoStream,\n 'Rendered',\n renderer\n );\n context.setRemoteVideoStreamRendererView(\n callId,\n participantKey,\n remoteStreamId,\n convertFromSDKToDeclarativeVideoStreamRendererView(view)\n );\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n } else if (streamEventType === 'createViewLocal') {\n internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n refreshedRenderInfo.stream as LocalVideoStream,\n 'Rendered',\n renderer\n );\n context.setLocalVideoStreamRendererView(\n callId,\n localStreamKey,\n convertFromSDKToDeclarativeVideoStreamRendererView(view)\n );\n _logStreamEvent(EventNames.VIEW_RENDER_SUCCEED, streamLogInfo);\n }\n\n return {\n renderer,\n view\n };\n}\n\nasync function createViewUnparentedVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n stream: LocalVideoStreamState,\n options?: CreateViewOptions\n): Promise<CreateViewResult | undefined> {\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n\n if (renderInfo && renderInfo.status === 'Rendered') {\n console.warn('Unparented LocalVideoStream is already rendered');\n return;\n }\n\n if (renderInfo && renderInfo.status === 'Rendering') {\n // Do not log to console here as this is a very common situation due to UI rerenders while\n // the video rendering is in progress.\n return;\n }\n\n if (renderInfo && renderInfo.status === 'Stopping') {\n console.warn('Unparented LocalVideoStream is in the middle of stopping');\n return;\n }\n\n const localVideoStream = new LocalVideoStream(stream.source);\n const renderer = new VideoStreamRenderer(localVideoStream);\n\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendering', undefined);\n\n let view: VideoStreamRendererView;\n try {\n view = await renderer.createView(options);\n } catch (e) {\n // Special case for unparented views. Since they are not tied to anything and created by us based on the calls to\n // this function we'll delete it to clean up the data since keeping it around doesn't help us and if developer wants\n // to create a new view they can check that the view is not rendered and call this function again.\n internalContext.deleteUnparentedRenderInfo(stream);\n throw e;\n }\n\n // Since render could take some time, we need to check if the stream is still valid and if we received a signal to\n // stop rendering.\n const refreshedRenderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!refreshedRenderInfo) {\n // Unparented stream's RenderInfo was deleted. Currently this shouldn't happen but if it does we'll just dispose the\n // renderer and clean up state. If developer wanted the stream they could call this function again and that should\n // generate new working state via this function.\n renderer.dispose();\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n\n if (refreshedRenderInfo.status === 'Stopping') {\n // Stop render was called on this stream after we had started rendering. We will dispose this view and do not\n // put the view into the state. Special case for unparented views, delete them from state when stopped to free up\n // the memory since we were the ones generating this and not tied to any Call state.\n internalContext.deleteUnparentedRenderInfo(stream);\n context.deleteDeviceManagerUnparentedView(stream);\n return;\n }\n // Else the stream still exists and status is not telling us to stop rendering. Complete the render process by\n // updating the state.\n internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendered', renderer);\n internalContext.subscribeToUnparentedViewVideoEffects(localVideoStream, context);\n context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));\n\n return {\n renderer,\n view\n };\n}\n\nfunction disposeViewVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string,\n stream: RemoteVideoStreamState | LocalVideoStreamState,\n participantId?: CommunicationIdentifierKind | string\n): void {\n // we can only have 3 types of createView\n let streamEventType: 'disposeViewLocal' | 'disposeViewRemote' | 'disposeViewUnparented';\n\n // we will reuse these for local as well but we need to make sure the remote stream is passed in like before.\n\n if (participantId) {\n streamEventType = 'disposeViewRemote';\n } else if (callId) {\n streamEventType = 'disposeViewLocal';\n } else {\n // TODO update for when unparented view.\n streamEventType = 'disposeViewUnparented';\n }\n\n const streamType = stream.mediaStreamType;\n const localStreamKey = (stream as LocalVideoStream).mediaStreamType;\n const remoteStreamId = (stream as RemoteVideoStream).id;\n\n // we want to check to see if there is a participantId this will tell us whether its a local stream or a remote one.\n const participantKey =\n streamEventType === 'disposeViewRemote' && participantId\n ? typeof participantId === 'string'\n ? participantId\n : toFlatCommunicationIdentifier(participantId)\n : undefined;\n const streamLogInfo = { callId, participantKey, streamId: remoteStreamId ?? localStreamKey, streamType };\n\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n context.setRemoteVideoStreamRendererView(callId, participantKey, remoteStreamId, undefined);\n }\n\n const renderInfo =\n streamEventType === 'disposeViewRemote' && participantKey\n ? internalContext.getRemoteRenderInfoForParticipant(callId, participantKey, remoteStreamId)\n : internalContext.getLocalRenderInfo(callId, localStreamKey);\n\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n\n // Nothing to dispose of or clean up -- we can safely exit early here.\n if (renderInfo.status === 'NotRendered') {\n _logStreamEvent(EventNames.STREAM_ALREADY_DISPOSED, streamLogInfo);\n return;\n }\n\n // Status is already marked as \"stopping\" so we can exit early here. This is because stopping only occurs\n // when the stream is being created in createView but hasn't been completed being created yet. The createView\n // method will see the \"stopping\" status and perform the cleanup\n if (renderInfo.status === 'Stopping') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n return;\n }\n\n // If the stream is in the middle of being rendered (i.e. has state \"Rendering\"), we need the status as\n // \"stopping\" without performing any cleanup. This will tell the `createView` method that it should stop\n // rendering and clean up the state once the view has finished being created.\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n streamEventType === 'disposeViewRemote' && participantKey\n ? internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n renderInfo.stream as RemoteVideoStream,\n 'Stopping',\n undefined\n )\n : internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n renderInfo.stream as LocalVideoStream,\n 'Stopping',\n renderInfo.renderer\n );\n return;\n }\n\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n // Else the state must be in the \"Rendered\" state, so we can dispose the renderer and clean up the state.\n if (streamEventType === 'disposeViewRemote' && participantKey) {\n internalContext.setRemoteRenderInfo(\n callId,\n participantKey,\n remoteStreamId,\n renderInfo.stream as RemoteVideoStream,\n 'NotRendered',\n undefined\n );\n } else if (streamEventType === 'disposeViewLocal') {\n internalContext.setLocalRenderInfo(\n callId,\n localStreamKey,\n renderInfo.stream as LocalVideoStream,\n 'NotRendered',\n undefined\n );\n context.setLocalVideoStreamRendererView(callId, localStreamKey, undefined);\n }\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\n\nfunction disposeViewUnparentedVideo(\n context: CallContext,\n internalContext: InternalCallContext,\n stream: LocalVideoStreamState\n): void {\n const streamType = stream.mediaStreamType;\n const streamLogInfo = { streamType, streamEventType: 'disposeViewUnparented' };\n\n _logStreamEvent(EventNames.START_DISPOSE_STREAM, streamLogInfo);\n\n context.deleteDeviceManagerUnparentedView(stream);\n\n const renderInfo = internalContext.getUnparentedRenderInfo(stream);\n if (!renderInfo) {\n _logStreamEvent(EventNames.DISPOSE_INFO_NOT_FOUND, streamLogInfo);\n return;\n }\n\n if (renderInfo.status === 'Rendering') {\n _logStreamEvent(EventNames.STREAM_STOPPING, streamLogInfo);\n internalContext.setUnparentedRenderInfo(stream, renderInfo.stream, 'Stopping', undefined);\n } else {\n internalContext.deleteUnparentedRenderInfo(stream);\n }\n\n if (renderInfo.renderer) {\n _logStreamEvent(EventNames.DISPOSING_RENDERER, streamLogInfo);\n renderInfo.renderer.dispose();\n } else {\n _logStreamEvent(EventNames.RENDERER_NOT_FOUND, streamLogInfo);\n }\n}\n\n/**\n * @private\n */\nexport function createView(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState,\n options?: CreateViewOptions\n): Promise<CreateViewResult | undefined> {\n const streamType = stream.mediaStreamType;\n\n if (callId) {\n return createViewVideo(context, internalContext, callId, stream, participantId, options);\n } else if (!('id' in stream) && !callId) {\n // Render LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a startLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n return context.withAsyncErrorTeedToState(\n async () => await createViewUnparentedVideo(context, internalContext, stream, options),\n 'Call.startVideo'\n )();\n } else {\n _logStreamEvent(EventNames.CREATE_STREAM_INVALID_PARAMS, { streamType });\n return Promise.resolve(undefined);\n }\n}\n\n/**\n * @private\n */\nexport function disposeView(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string | undefined,\n participantId: CommunicationIdentifierKind | string | undefined,\n stream: LocalVideoStreamState | RemoteVideoStreamState\n): void {\n const streamType = stream.mediaStreamType;\n if (callId) {\n disposeViewVideo(context, internalContext, callId, stream, participantId);\n } else if (!('id' in stream) && !callId) {\n // Stop rendering LocalVideoStream that is not part of a Call\n // Because it is not part of the call we don't tee errors to state naturally (e.g. via a Call Client function such as startVideo).\n // We do not have a stopLocalPreviewVideo function, so as a workaround we ensure any errors are propagated here.\n context.withErrorTeedToState(\n () => disposeViewUnparentedVideo(context, internalContext, stream),\n 'Call.stopVideo'\n )();\n } else {\n _logStreamEvent(EventNames.DISPOSE_STREAM_INVALID_PARAMS, { streamType });\n return;\n }\n}\n\n/**\n * @private\n * Only stops videos that are tied to a Call.\n */\nexport function disposeAllViewsFromCall(\n context: CallContext,\n internalContext: InternalCallContext,\n callId: string\n): void {\n const remoteStreams = internalContext.getRemoteRenderInfoForCall(callId);\n if (remoteStreams) {\n for (const [participantKey, participantStreams] of remoteStreams.entries()) {\n for (const [_, remoteStreamAndRenderer] of participantStreams.entries()) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(\n context,\n internalContext,\n callId,\n participantKey,\n convertSdkRemoteStreamToDeclarativeRemoteStream(remoteStreamAndRenderer.stream)\n );\n }\n }\n }\n\n const localStreams = internalContext.getLocalRenderInfosForCall(callId);\n if (localStreams) {\n for (const localStreamAndRenderer of localStreams.values()) {\n if (localStreamAndRenderer && localStreamAndRenderer.renderer) {\n // We don't want to accept SDK stream as parameter but we also don't cache the declarative stream so we have to\n // convert the SDK stream to declarative stream which is not pretty so this could use some further refactoring.\n disposeView(\n context,\n internalContext,\n callId,\n undefined,\n convertSdkLocalStreamToDeclarativeLocalStream(localStreamAndRenderer.stream)\n );\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport function disposeAllViews(context: CallContext, internalContext: InternalCallContext): void {\n const callIds = internalContext.getCallIds();\n for (const callId of callIds) {\n disposeAllViewsFromCall(context, internalContext, callId);\n }\n}\n\"../../acs-ui-common/src\""]}
|
@@ -10,7 +10,7 @@ import { EventNames } from './Logger';
|
|
10
10
|
export declare function _logStreamEvent(eventName: EventNames, streamLogInfo: {
|
11
11
|
callId?: string;
|
12
12
|
participantKey?: any;
|
13
|
-
streamId?: number;
|
13
|
+
streamId?: number | string;
|
14
14
|
streamType?: MediaStreamType;
|
15
15
|
streamEventType?: string;
|
16
16
|
}, error?: unknown): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"StreamUtilsLogging.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/StreamUtilsLogging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D;gBAC1D,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU,CAAC,uBAAuB;YACrC,SAAS,CAAC,qBAAqB,EAAE;gBAC/B,IAAI,EAAE,UAAU,CAAC,uBAAuB;gBACxC,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,mDAAmD;gBAC5D,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU,CAAC,mBAAmB;YACjC,SAAS,CAAC,qBAAqB,EAAE;gBAC/B,IAAI,EAAE,UAAU,CAAC,mBAAmB;gBACpC,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,+BAA+B;gBACxC,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU,CAAC,aAAa;YAC3B,SAAS,CAAC,qBAAqB,EAAE;gBAC/B,IAAI,EAAE,UAAU,CAAC,aAAa;gBAC9B,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,uCAAuC;gBAChD,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT;YACE,OAAO;KACV;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAqB,EACrB,aAMC,EACD,KAAe;IAEf,IACE,aAAa,CAAC,eAAe,KAAK,kBAAkB;QACpD,aAAa,CAAC,eAAe,KAAK,mBAAmB;QACrD,aAAa,CAAC,eAAe,KAAK,uBAAuB,EACzD;QACA,sBAAsB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;KAClD;SAAM,IACL,aAAa,CAAC,eAAe,KAAK,iBAAiB;QACnD,aAAa,CAAC,eAAe,KAAK,kBAAkB,EACpD;QACA,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;KACxD;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MediaStreamType } from '@azure/communication-calling';\nimport { _logEvent } from '@internal/acs-ui-common';\nimport { callingStatefulLogger, EventNames } from './Logger';\n\n/**\n * helper function to manage logging for stream disposals\n *\n * @param eventName Name of event that occured when managing streams\n * @param streamLogInfo Data about the stream in the event\n * @returns\n */\nfunction _logDisposeStreamEvent(\n eventName: EventNames,\n streamLogInfo: {\n callId?: string;\n participantKey?: any;\n streamId?: number;\n streamType?: MediaStreamType;\n streamEventType?: string;\n }\n): void {\n switch (eventName) {\n case EventNames.DISPOSE_STREAM_INVALID_PARAMS:\n _logEvent(callingStatefulLogger, {\n name: EventNames.DISPOSE_STREAM_INVALID_PARAMS,\n level: 'warning',\n message: 'Dispose View invalid combination of parameters.',\n data: { streamType: streamLogInfo.streamType }\n });\n return;\n case EventNames.START_DISPOSE_STREAM:\n _logEvent(callingStatefulLogger, {\n name: EventNames.START_DISPOSE_STREAM,\n level: 'info',\n message: 'Start disposing stream.',\n data: streamLogInfo\n });\n return;\n case EventNames.DISPOSE_INFO_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.DISPOSE_INFO_NOT_FOUND,\n level: 'error',\n message: 'Cannot find render info when disposing stream.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_STOPPING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_STOPPING,\n level: 'info',\n message: 'Stream is currently marked as stopping, will continue if is local preview',\n data: streamLogInfo\n });\n return;\n case EventNames.DISPOSING_RENDERER:\n _logEvent(callingStatefulLogger, {\n name: EventNames.DISPOSING_RENDERER,\n level: 'info',\n message: 'Disposing view renderer.',\n data: streamLogInfo\n });\n return;\n case EventNames.RENDERER_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.RENDERER_NOT_FOUND,\n level: 'error',\n message: 'Cannot find renderer when disposing stream.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_ALREADY_DISPOSED:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_ALREADY_DISPOSED,\n level: 'info',\n message: 'Stream is already disposed.',\n data: streamLogInfo\n });\n return;\n default:\n return;\n }\n}\n\n/**\n * helper function to manage logging for local stream creations\n *\n * @param eventName Name of the event to occured when creating a local stream\n * @param streamLogInfo Data about the stream in the event\n * @param error that is thrown by caller\n * @returns\n */\nfunction _logCreateStreamEvent(\n eventName: string,\n streamLogInfo: {\n callId?: string;\n participantKey?: any;\n streamId?: number;\n streamType?: MediaStreamType;\n streamEventType?: string;\n },\n error?: unknown\n): void {\n switch (eventName) {\n case EventNames.CREATE_STREAM_INVALID_PARAMS:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATE_STREAM_INVALID_PARAMS,\n level: 'warning',\n message: 'Create View invalid combination of parameters.',\n data: { streamType: streamLogInfo.streamType }\n });\n return;\n case EventNames.START_STREAM_RENDERING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.START_STREAM_RENDERING,\n level: 'info',\n message: 'Start creating view for local video.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_NOT_FOUND,\n level: 'error',\n message: 'Stream not found in state.',\n data: { callId: streamLogInfo.callId }\n });\n return;\n case EventNames.STREAM_ALREADY_RENDERED:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_ALREADY_RENDERED,\n level: 'warning',\n message: 'Stream is already rendered.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_RENDERING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_RENDERING,\n level: 'warning',\n message: 'Stream is rendering.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_STOPPING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_STOPPING,\n level: 'warning',\n message: 'Stream was marked as stopping by dispose view. Resetting state to \"Rendering\".',\n data: streamLogInfo\n });\n return;\n case EventNames.CREATE_STREAM_FAIL:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATE_STREAM_FAIL,\n level: 'error',\n message: 'Failed to create view.',\n data: {\n error: error,\n streamType: streamLogInfo.streamType,\n callId: streamLogInfo.callId\n }\n });\n return;\n case EventNames.RENDER_INFO_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.RENDER_INFO_NOT_FOUND,\n level: 'error',\n message: 'Cannot find render info after create the view. ',\n data: streamLogInfo\n });\n return;\n case EventNames.CREATED_STREAM_STOPPING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATED_STREAM_STOPPING,\n level: 'warning',\n message: 'Render info status is stopping, dispose renderer.',\n data: streamLogInfo\n });\n return;\n case EventNames.VIEW_RENDER_SUCCEED:\n _logEvent(callingStatefulLogger, {\n name: EventNames.VIEW_RENDER_SUCCEED,\n level: 'info',\n message: `Successfully render the view.`,\n data: streamLogInfo\n });\n return;\n case EventNames.CREATING_VIEW:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATING_VIEW,\n level: 'info',\n message: 'Start creating view for remote video.',\n data: streamLogInfo\n });\n return;\n default:\n return;\n }\n}\n\n/**\n * helper function to fire streamUtils logging events\n *\n * @param eventName Name of event from streamUtils\n * @param streamLogInfo informaiton about the event and who called it\n * @param error if any errors present will be added to message in logging\n */\nexport function _logStreamEvent(\n eventName: EventNames,\n streamLogInfo: {\n callId?: string;\n participantKey?: any;\n streamId?: number;\n streamType?: MediaStreamType;\n streamEventType?: string;\n },\n error?: unknown\n): void {\n if (\n streamLogInfo.streamEventType === 'disposeViewLocal' ||\n streamLogInfo.streamEventType === 'disposeViewRemote' ||\n streamLogInfo.streamEventType === 'disposeViewUnparented'\n ) {\n _logDisposeStreamEvent(eventName, streamLogInfo);\n } else if (\n streamLogInfo.streamEventType === 'createViewLocal' ||\n streamLogInfo.streamEventType === 'createViewRemote'\n ) {\n _logCreateStreamEvent(eventName, streamLogInfo, error);\n }\n}\n\"../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"StreamUtilsLogging.js","sourceRoot":"","sources":["../../../../../calling-stateful-client/src/StreamUtilsLogging.ts"],"names":[],"m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I,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU,CAAC,uBAAuB;YACrC,SAAS,CAAC,qBAAqB,EAAE;gBAC/B,IAAI,EAAE,UAAU,CAAC,uBAAuB;gBACxC,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,mDAAmD;gBAC5D,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU,CAAC,mBAAmB;YACjC,SAAS,CAAC,qBAAqB,EAAE;gBAC/B,IAAI,EAAE,UAAU,CAAC,mBAAmB;gBACpC,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,+BAA+B;gBACxC,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT,KAAK,UAAU,CAAC,aAAa;YAC3B,SAAS,CAAC,qBAAqB,EAAE;gBAC/B,IAAI,EAAE,UAAU,CAAC,aAAa;gBAC9B,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,uCAAuC;gBAChD,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,OAAO;QACT;YACE,OAAO;KACV;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAqB,EACrB,aAMC,EACD,KAAe;IAEf,IACE,aAAa,CAAC,eAAe,KAAK,kBAAkB;QACpD,aAAa,CAAC,eAAe,KAAK,mBAAmB;QACrD,aAAa,CAAC,eAAe,KAAK,uBAAuB,EACzD;QACA,sBAAsB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;KAClD;SAAM,IACL,aAAa,CAAC,eAAe,KAAK,iBAAiB;QACnD,aAAa,CAAC,eAAe,KAAK,kBAAkB,EACpD;QACA,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;KACxD;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MediaStreamType } from '@azure/communication-calling';\nimport { _logEvent } from '@internal/acs-ui-common';\nimport { callingStatefulLogger, EventNames } from './Logger';\n\n/**\n * helper function to manage logging for stream disposals\n *\n * @param eventName Name of event that occured when managing streams\n * @param streamLogInfo Data about the stream in the event\n * @returns\n */\nfunction _logDisposeStreamEvent(\n eventName: EventNames,\n streamLogInfo: {\n callId?: string;\n participantKey?: any;\n streamId?: number | string;\n streamType?: MediaStreamType;\n streamEventType?: string;\n }\n): void {\n switch (eventName) {\n case EventNames.DISPOSE_STREAM_INVALID_PARAMS:\n _logEvent(callingStatefulLogger, {\n name: EventNames.DISPOSE_STREAM_INVALID_PARAMS,\n level: 'warning',\n message: 'Dispose View invalid combination of parameters.',\n data: { streamType: streamLogInfo.streamType }\n });\n return;\n case EventNames.START_DISPOSE_STREAM:\n _logEvent(callingStatefulLogger, {\n name: EventNames.START_DISPOSE_STREAM,\n level: 'info',\n message: 'Start disposing stream.',\n data: streamLogInfo\n });\n return;\n case EventNames.DISPOSE_INFO_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.DISPOSE_INFO_NOT_FOUND,\n level: 'error',\n message: 'Cannot find render info when disposing stream.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_STOPPING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_STOPPING,\n level: 'info',\n message: 'Stream is currently marked as stopping, will continue if is local preview',\n data: streamLogInfo\n });\n return;\n case EventNames.DISPOSING_RENDERER:\n _logEvent(callingStatefulLogger, {\n name: EventNames.DISPOSING_RENDERER,\n level: 'info',\n message: 'Disposing view renderer.',\n data: streamLogInfo\n });\n return;\n case EventNames.RENDERER_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.RENDERER_NOT_FOUND,\n level: 'error',\n message: 'Cannot find renderer when disposing stream.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_ALREADY_DISPOSED:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_ALREADY_DISPOSED,\n level: 'info',\n message: 'Stream is already disposed.',\n data: streamLogInfo\n });\n return;\n default:\n return;\n }\n}\n\n/**\n * helper function to manage logging for local stream creations\n *\n * @param eventName Name of the event to occured when creating a local stream\n * @param streamLogInfo Data about the stream in the event\n * @param error that is thrown by caller\n * @returns\n */\nfunction _logCreateStreamEvent(\n eventName: string,\n streamLogInfo: {\n callId?: string;\n participantKey?: any;\n streamId?: number | string;\n streamType?: MediaStreamType;\n streamEventType?: string;\n },\n error?: unknown\n): void {\n switch (eventName) {\n case EventNames.CREATE_STREAM_INVALID_PARAMS:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATE_STREAM_INVALID_PARAMS,\n level: 'warning',\n message: 'Create View invalid combination of parameters.',\n data: { streamType: streamLogInfo.streamType }\n });\n return;\n case EventNames.START_STREAM_RENDERING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.START_STREAM_RENDERING,\n level: 'info',\n message: 'Start creating view for local video.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_NOT_FOUND,\n level: 'error',\n message: 'Stream not found in state.',\n data: { callId: streamLogInfo.callId }\n });\n return;\n case EventNames.STREAM_ALREADY_RENDERED:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_ALREADY_RENDERED,\n level: 'warning',\n message: 'Stream is already rendered.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_RENDERING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_RENDERING,\n level: 'warning',\n message: 'Stream is rendering.',\n data: streamLogInfo\n });\n return;\n case EventNames.STREAM_STOPPING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.STREAM_STOPPING,\n level: 'warning',\n message: 'Stream was marked as stopping by dispose view. Resetting state to \"Rendering\".',\n data: streamLogInfo\n });\n return;\n case EventNames.CREATE_STREAM_FAIL:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATE_STREAM_FAIL,\n level: 'error',\n message: 'Failed to create view.',\n data: {\n error: error,\n streamType: streamLogInfo.streamType,\n callId: streamLogInfo.callId\n }\n });\n return;\n case EventNames.RENDER_INFO_NOT_FOUND:\n _logEvent(callingStatefulLogger, {\n name: EventNames.RENDER_INFO_NOT_FOUND,\n level: 'error',\n message: 'Cannot find render info after create the view. ',\n data: streamLogInfo\n });\n return;\n case EventNames.CREATED_STREAM_STOPPING:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATED_STREAM_STOPPING,\n level: 'warning',\n message: 'Render info status is stopping, dispose renderer.',\n data: streamLogInfo\n });\n return;\n case EventNames.VIEW_RENDER_SUCCEED:\n _logEvent(callingStatefulLogger, {\n name: EventNames.VIEW_RENDER_SUCCEED,\n level: 'info',\n message: `Successfully render the view.`,\n data: streamLogInfo\n });\n return;\n case EventNames.CREATING_VIEW:\n _logEvent(callingStatefulLogger, {\n name: EventNames.CREATING_VIEW,\n level: 'info',\n message: 'Start creating view for remote video.',\n data: streamLogInfo\n });\n return;\n default:\n return;\n }\n}\n\n/**\n * helper function to fire streamUtils logging events\n *\n * @param eventName Name of event from streamUtils\n * @param streamLogInfo informaiton about the event and who called it\n * @param error if any errors present will be added to message in logging\n */\nexport function _logStreamEvent(\n eventName: EventNames,\n streamLogInfo: {\n callId?: string;\n participantKey?: any;\n streamId?: number | string;\n streamType?: MediaStreamType;\n streamEventType?: string;\n },\n error?: unknown\n): void {\n if (\n streamLogInfo.streamEventType === 'disposeViewLocal' ||\n streamLogInfo.streamEventType === 'disposeViewRemote' ||\n streamLogInfo.streamEventType === 'disposeViewUnparented'\n ) {\n _logDisposeStreamEvent(eventName, streamLogInfo);\n } else if (\n streamLogInfo.streamEventType === 'createViewLocal' ||\n streamLogInfo.streamEventType === 'createViewRemote'\n ) {\n _logCreateStreamEvent(eventName, streamLogInfo, error);\n }\n}\n\"../../acs-ui-common/src\""]}
|
@@ -62,13 +62,13 @@ export declare type StatefulChatClientOptions = {
|
|
62
62
|
*
|
63
63
|
* @public
|
64
64
|
*/
|
65
|
-
export declare const createStatefulChatClient: (args: StatefulChatClientArgs, options?: StatefulChatClientOptions
|
65
|
+
export declare const createStatefulChatClient: (args: StatefulChatClientArgs, options?: StatefulChatClientOptions) => StatefulChatClient;
|
66
66
|
/**
|
67
67
|
* This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.
|
68
68
|
*
|
69
69
|
* @internal
|
70
70
|
*/
|
71
|
-
export declare const _createStatefulChatClientInner: (args: StatefulChatClientArgs, options?: StatefulChatClientOptions
|
71
|
+
export declare const _createStatefulChatClientInner: (args: StatefulChatClientArgs, options?: StatefulChatClientOptions, telemetryImplementationHint?: _TelemetryImplementationHint) => StatefulChatClient;
|
72
72
|
/**
|
73
73
|
* A function to modify the state of the StatefulChatClient.
|
74
74
|
*
|
@@ -86,5 +86,5 @@ export declare type ChatStateModifier = (state: ChatClientState) => void;
|
|
86
86
|
* Used by tests. Should not be exported out of this package.
|
87
87
|
* @internal
|
88
88
|
*/
|
89
|
-
export declare const _createStatefulChatClientWithDeps: (chatClient: ChatClient, args: StatefulChatClientArgs, options?: StatefulChatClientOptions
|
89
|
+
export declare const _createStatefulChatClientWithDeps: (chatClient: ChatClient, args: StatefulChatClientArgs, options?: StatefulChatClientOptions) => StatefulChatClient;
|
90
90
|
//# sourceMappingURL=StatefulChatClient.d.ts.map
|
@@ -4,5 +4,5 @@ import { ChatMessageWithStatus } from './types/ChatMessageWithStatus';
|
|
4
4
|
/**
|
5
5
|
* @private
|
6
6
|
*/
|
7
|
-
export declare const convertChatMessage: (message: ChatMessage, status?: MessageStatus, clientMessageId?: string
|
7
|
+
export declare const convertChatMessage: (message: ChatMessage, status?: MessageStatus, clientMessageId?: string) => ChatMessageWithStatus;
|
8
8
|
//# sourceMappingURL=convertChatMessage.d.ts.map
|
@@ -4,5 +4,5 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
4
4
|
/**
|
5
5
|
* @private
|
6
6
|
*/
|
7
|
-
export declare const createDecoratedListMessages: (chatThreadClient: ChatThreadClient, context: ChatContext) => (options?: RestListMessagesOptions
|
7
|
+
export declare const createDecoratedListMessages: (chatThreadClient: ChatThreadClient, context: ChatContext) => (options?: RestListMessagesOptions) => PagedAsyncIterableIterator<ChatMessage>;
|
8
8
|
//# sourceMappingURL=createDecoratedListMessages.d.ts.map
|
package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.d.ts
CHANGED
@@ -4,5 +4,5 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
4
4
|
/**
|
5
5
|
* @private
|
6
6
|
*/
|
7
|
-
export declare const createDecoratedListParticipants: (chatThreadClient: ChatThreadClient, context: ChatContext) => (options?: RestListParticipantsOptions
|
7
|
+
export declare const createDecoratedListParticipants: (chatThreadClient: ChatThreadClient, context: ChatContext) => (options?: RestListParticipantsOptions) => PagedAsyncIterableIterator<ChatParticipant>;
|
8
8
|
//# sourceMappingURL=createDecoratedListParticipants.d.ts.map
|
@@ -4,5 +4,5 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
4
4
|
/**
|
5
5
|
* @private
|
6
6
|
*/
|
7
|
-
export declare const createDecoratedListThreads: (chatClient: ChatClient, context: ChatContext) => (options?: RestListChatThreadsOptions
|
7
|
+
export declare const createDecoratedListThreads: (chatClient: ChatClient, context: ChatContext) => (options?: RestListChatThreadsOptions) => PagedAsyncIterableIterator<ChatThreadItem>;
|
8
8
|
//# sourceMappingURL=createDecoratedListThreads.d.ts.map
|
@@ -25,7 +25,7 @@ export declare type Selector = (state: ClientState, props: any) => any;
|
|
25
25
|
*
|
26
26
|
* @public
|
27
27
|
*/
|
28
|
-
export declare const useSelector: <ParamT extends Selector | undefined>(selector: ParamT, selectorProps?: (ParamT extends Selector ? Parameters<ParamT>[1] : undefined) | undefined, type?:
|
28
|
+
export declare const useSelector: <ParamT extends Selector | undefined>(selector: ParamT, selectorProps?: (ParamT extends Selector ? Parameters<ParamT>[1] : undefined) | undefined, type?: 'calling' | 'chat') => ParamT extends Selector ? ReturnType<ParamT> : undefined;
|
29
29
|
/**
|
30
30
|
* Helper type for {@link usePropsFor}.
|
31
31
|
*
|
@@ -68,5 +68,5 @@ export declare type ComponentProps<Component extends (props: any) => JSX.Element
|
|
68
68
|
*
|
69
69
|
* @public
|
70
70
|
*/
|
71
|
-
export declare const usePropsFor: <Component extends (props: any) => JSX.Element>(component: Component, type?:
|
71
|
+
export declare const usePropsFor: <Component extends (props: any) => JSX.Element>(component: Component, type?: 'calling' | 'chat') => ComponentProps<Component>;
|
72
72
|
//# sourceMappingURL=mergedHooks.d.ts.map
|
@@ -207,7 +207,7 @@ export interface DeviceMenuStyles extends IContextualMenuStyles {
|
|
207
207
|
*
|
208
208
|
* @internal
|
209
209
|
*/
|
210
|
-
export declare const generateDefaultDeviceMenuProps: (props: DeviceMenuProps, strings: DeviceMenuStrings, primaryActionItem?: IContextualMenuItem
|
210
|
+
export declare const generateDefaultDeviceMenuProps: (props: DeviceMenuProps, strings: DeviceMenuStrings, primaryActionItem?: IContextualMenuItem, isSelectCamAllowed?: boolean, isSelectMicAllowed?: boolean) => {
|
211
211
|
items: IContextualMenuItem[];
|
212
212
|
} | undefined;
|
213
213
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DrawerMenu.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Drawer/DrawerMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAuCvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAe,EAAE;;IAClE,gGAAgG;IAChG,iGAAiG;IACjG,+EAA+E;IAC/E,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IAErE,6CAA6C;IAC7C,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE;;QACrC,IAAI,KAAK,GAAuC,KAAK,CAAC,KAAK,CAAC;QAC5D,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE;YACxC,KAAK,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,0CAAE,YAAY,CAAC;SAC1E;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC;IAEnC,oGAAoG;IACpG,kGAAkG;IAClG,MAAM,WAAW,GAAG,WAAW,CAC7B,CACE,IAA0B,EAC1B,EAA6F,EAC7F,OAA4B,EACtB,EAAE;;QACR,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,kBAAkB,CAAC,CAAC,GAAG,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SACxD;QAED,MAAA,IAAI,CAAC,WAAW
|
1
|
+
{"version":3,"file":"DrawerMenu.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Drawer/DrawerMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAA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E,EAAE;oBAC3B,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,IACD,CACH,CAAC,CACI,CACO,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { merge, Stack } from '@fluentui/react';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { _DrawerSurfaceProps } from '.';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport { BaseCustomStyles } from '../../types';\nimport { DrawerMenuItem, _DrawerMenuItemProps } from './DrawerMenuItem';\nimport { _DrawerSurface, _DrawerSurfaceStyles } from './DrawerSurface';\n\n/**\n * Styles for the {@link _DrawerMenu}.\n *\n * @internal\n */\nexport interface _DrawerMenuStyles extends BaseCustomStyles {\n /** Styles for the {@link DrawerSurface} container. */\n drawerSurfaceStyles?: _DrawerSurfaceStyles;\n}\n\n/**\n * Props for the {@link _DrawerMenu}\n *\n * @internal\n */\nexport interface _DrawerMenuProps {\n items: _DrawerMenuItemProps[];\n\n /**\n * Callback when the drawer's light-dismissal is triggered.\n */\n onLightDismiss: () => void;\n\n /**\n * String to show in heading of drawer menu\n */\n heading?: string;\n\n /**\n * By default, maxHeight value is set to 75%.\n * Set value to true for no default maxHeight to be applied on drawerSurface\n */\n disableMaxHeight?: boolean;\n\n styles?: _DrawerMenuStyles;\n}\n\n/**\n * Takes a set of menu items and returns a created menu inside a {@link _DrawerSurface}.\n *\n * @internal\n */\nexport const _DrawerMenu = (props: _DrawerMenuProps): JSX.Element => {\n // This component breaks from a pure component pattern in order to internally support sub menus.\n // When a sub menu item is clicked the menu items displayed is updated to be that of the submenu.\n // To track this state we store a list of the keys clicked up until this point.\n const [selectedKeyPath, setSelectedKeyPath] = useState<string[]>([]);\n\n // Get the menu items that should be rendered\n const menuItemsToRender = useMemo(() => {\n let items: _DrawerMenuItemProps[] | undefined = props.items;\n for (const subMenuKey of selectedKeyPath) {\n items = items?.find((item) => item.itemKey === subMenuKey)?.subMenuProps;\n }\n return items;\n }, [props.items, selectedKeyPath]);\n\n // When an item is clicked and it contains a submenu, push the key for the submenu. This will ensure\n // a new render is triggered, menuItemsToRender will be re-calculated and the submenu will render.\n const onItemClick = useCallback(\n (\n item: _DrawerMenuItemProps,\n ev?: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement> | undefined,\n itemKey?: string | undefined\n ): void => {\n if (item.subMenuProps) {\n setSelectedKeyPath([...selectedKeyPath, item.itemKey]);\n }\n\n item.onItemClick?.(ev, itemKey);\n },\n [selectedKeyPath]\n );\n\n // Ensure the first item has a border radius that matches the DrawerSurface\n const borderRadius = useTheme().effects.roundedCorner4;\n const firstItemStyle = menuItemsToRender && menuItemsToRender[0]?.styles;\n const modifiedFirstItemStyle = useMemo(\n () =>\n merge(firstItemStyle ?? {}, {\n root: {\n borderTopRightRadius: borderRadius,\n borderTopLeftRadius: borderRadius\n }\n }),\n [firstItemStyle, borderRadius]\n );\n\n return (\n <_DrawerSurface\n disableMaxHeight={props.disableMaxHeight}\n styles={props.styles?.drawerSurfaceStyles}\n onLightDismiss={props.onLightDismiss}\n heading={props.heading}\n >\n <Stack styles={props.styles} role=\"menu\" data-ui-id=\"drawer-menu\">\n {menuItemsToRender?.slice(0, 1).map((item) => (\n <DrawerMenuItem\n {...item}\n key={`${item.itemKey}` + '0'}\n shouldFocusOnMount={true}\n styles={modifiedFirstItemStyle}\n onItemClick={(ev, itemKey) => {\n onItemClick(item, ev, itemKey);\n }}\n />\n ))}\n {menuItemsToRender?.slice(1).map((item, i) => (\n <DrawerMenuItem\n {...item}\n key={`${item.itemKey}` + `${i + 1}`}\n onItemClick={(ev, itemKey) => {\n onItemClick(item, ev, itemKey);\n }}\n />\n ))}\n </Stack>\n </_DrawerSurface>\n );\n};\n"]}
|