@vkontakte/calls-sdk 2.8.11-dev.fdf6f999.0 → 2.8.12-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CallsSDK.d.ts +12 -24
- package/abstract/BaseApi.d.ts +4 -5
- package/abstract/BaseSignaling.d.ts +3 -4
- package/calls-sdk.cjs.js +9 -11
- package/calls-sdk.esm.js +6147 -5794
- package/classes/CallRegistry.d.ts +26 -0
- package/classes/Conversation.d.ts +48 -31
- package/classes/MediaSource.d.ts +7 -0
- package/classes/SpecListener.d.ts +5 -0
- package/classes/StatsLogger.d.ts +17 -5
- package/classes/codec/WorkerBase.d.ts +2 -0
- package/classes/stat/CallLifecycleStats.d.ts +47 -0
- package/classes/stat/ConversationStats.d.ts +5 -4
- package/classes/stat/FirstMediaSentProbe.d.ts +13 -0
- package/classes/stat/StatPings.d.ts +1 -2
- package/classes/stat/StatSignalingCommands.d.ts +1 -2
- package/classes/transport/BaseTransport.d.ts +7 -1
- package/classes/transport/DirectTransport.d.ts +6 -11
- package/classes/transport/ServerTransport.d.ts +1 -15
- package/classes/transport/Transport.d.ts +9 -21
- package/default/Api.d.ts +9 -8
- package/default/Signaling.d.ts +2 -0
- package/default/SignalingTransport.d.ts +3 -1
- package/enums/HangupType.d.ts +1 -0
- package/enums/SignalingNotification.d.ts +3 -1
- package/enums/Stat.d.ts +6 -1
- package/package.json +1 -1
- package/static/Capabilities.d.ts +5 -0
- package/static/External.d.ts +143 -76
- package/static/Params.d.ts +103 -100
- package/static/ParticipantConnectionStatusUtils.d.ts +16 -0
- package/types/Capabilities.d.ts +24 -0
- package/types/Conversation.d.ts +12 -2
- package/types/ExternalId.d.ts +1 -1
- package/types/Participant.d.ts +12 -1
- package/types/PushData.d.ts +3 -0
- package/types/SignalingMessage.d.ts +14 -1
- package/types/Statistics.d.ts +0 -4
- package/types/WebTransport.d.ts +3 -1
- package/static/DebugVideoStats.d.ts +0 -37
- package/types/VideoStreamDebug.d.ts +0 -5
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Conversation from './Conversation';
|
|
2
|
+
import MediaSettings from '../types/MediaSettings';
|
|
3
|
+
export interface HoldableConversation extends Conversation {
|
|
4
|
+
id: string;
|
|
5
|
+
hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class CallRegistry {
|
|
8
|
+
private _conversations;
|
|
9
|
+
private _activeId;
|
|
10
|
+
private _mutex;
|
|
11
|
+
add(conversation: HoldableConversation): void;
|
|
12
|
+
remove(id: string | null): void;
|
|
13
|
+
get(id: string): HoldableConversation | undefined;
|
|
14
|
+
getActive(): HoldableConversation | null;
|
|
15
|
+
getFirst(): HoldableConversation | null;
|
|
16
|
+
getActiveId(): string | null;
|
|
17
|
+
has(id: string): boolean;
|
|
18
|
+
getAll(): HoldableConversation[];
|
|
19
|
+
get callsLength(): number;
|
|
20
|
+
setActive(id: string): Promise<void>;
|
|
21
|
+
setHold(id: string): Promise<void>;
|
|
22
|
+
switchCall(id: string): Promise<void>;
|
|
23
|
+
clear(): void;
|
|
24
|
+
}
|
|
25
|
+
declare const callRegistry: CallRegistry;
|
|
26
|
+
export { callRegistry };
|
|
@@ -12,11 +12,10 @@ import UserType from '../enums/UserType';
|
|
|
12
12
|
import { JSONObject } from '../static/Json';
|
|
13
13
|
import { IAsrStartParams, IAsrStopParams } from '../types/Asr';
|
|
14
14
|
import { AudienceModeHandsResponse } from '../types/AudienceMode';
|
|
15
|
-
import { ConversationData, ConversationOnStartParams } from '../types/Conversation';
|
|
16
|
-
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk
|
|
17
|
-
import type { FastJoinHandler } from '../types/FastJoin';
|
|
15
|
+
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../types/Conversation';
|
|
16
|
+
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../types/ExternalId';
|
|
18
17
|
import MediaModifiers from '../types/MediaModifiers';
|
|
19
|
-
import { IVideoDimentions } from '../types/MediaSettings';
|
|
18
|
+
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
20
19
|
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
21
20
|
import MuteStates from '../types/MuteStates';
|
|
22
21
|
import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../types/Participant';
|
|
@@ -37,9 +36,13 @@ export default class Conversation extends EventEmitter {
|
|
|
37
36
|
private _conversation;
|
|
38
37
|
private _myLastRequestedLayouts;
|
|
39
38
|
private _state;
|
|
39
|
+
private _previousState;
|
|
40
|
+
/** Если пользователь в зале ожидания, холд должен вызываться после промоута */
|
|
41
|
+
private _waitingHallHoldPending;
|
|
40
42
|
private _participantState;
|
|
41
43
|
private _participants;
|
|
42
44
|
private _pendingParticipants;
|
|
45
|
+
private _directTransportIsMaster?;
|
|
43
46
|
private _transport;
|
|
44
47
|
private _debugInfo;
|
|
45
48
|
private readonly _debug;
|
|
@@ -52,10 +55,10 @@ export default class Conversation extends EventEmitter {
|
|
|
52
55
|
private _isRealTimeAsrRequested;
|
|
53
56
|
private _serverSettings;
|
|
54
57
|
private _serverTimeOffset;
|
|
55
|
-
private
|
|
56
|
-
private
|
|
57
|
-
private
|
|
58
|
-
private
|
|
58
|
+
private _delayedHangup;
|
|
59
|
+
private _abortController;
|
|
60
|
+
private _registeredPeerReceived;
|
|
61
|
+
private _calleeUnavailableTimer;
|
|
59
62
|
private readonly _onUnload;
|
|
60
63
|
private readonly _audioOutput;
|
|
61
64
|
private readonly _stats;
|
|
@@ -64,8 +67,6 @@ export default class Conversation extends EventEmitter {
|
|
|
64
67
|
private _audioFix;
|
|
65
68
|
private _streamByStreamId;
|
|
66
69
|
private _streamIdByStreamDescription;
|
|
67
|
-
private _participantIdByDebugStreamId;
|
|
68
|
-
private _mediaTypeByDebugStreamId;
|
|
69
70
|
private _streamWaitTimerByStreamDescription;
|
|
70
71
|
private _sequenceNumberByStreamDescription;
|
|
71
72
|
private _cooldownTimestampByStreamDescription;
|
|
@@ -75,19 +76,15 @@ export default class Conversation extends EventEmitter {
|
|
|
75
76
|
static current(): Conversation | null;
|
|
76
77
|
static hangupAfterInit(): void;
|
|
77
78
|
static id(): string | null;
|
|
79
|
+
get id(): string;
|
|
80
|
+
get externalId(): ExternalParticipantId | undefined;
|
|
81
|
+
get mediaSettings(): MediaSettings | undefined;
|
|
82
|
+
get isCallHeld(): boolean;
|
|
78
83
|
static debugSessionId(): string | null;
|
|
79
84
|
static getSyncedTime(): number;
|
|
80
85
|
get debugSessionId(): string | null;
|
|
81
86
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
82
|
-
onJoin(joinArgs:
|
|
83
|
-
conversationId?: string;
|
|
84
|
-
mediaOptions: MediaOption[];
|
|
85
|
-
chatId?: string;
|
|
86
|
-
joinLink?: string;
|
|
87
|
-
observedIds?: ExternalUserId[];
|
|
88
|
-
payload?: string;
|
|
89
|
-
onFastJoin?: FastJoinHandler;
|
|
90
|
-
}): Promise<ConversationData>;
|
|
87
|
+
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
91
88
|
private _onJoinPart2;
|
|
92
89
|
private _extractExternalRooms;
|
|
93
90
|
private _extractExternalRoomsData;
|
|
@@ -100,7 +97,6 @@ export default class Conversation extends EventEmitter {
|
|
|
100
97
|
private _acceptConcurrent;
|
|
101
98
|
private _getMainRoomParticipants;
|
|
102
99
|
private _decodeExternalConversationParams;
|
|
103
|
-
private _logCallStartEvent;
|
|
104
100
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
105
101
|
decline(): Promise<void>;
|
|
106
102
|
hangup(): Promise<void>;
|
|
@@ -110,11 +106,13 @@ export default class Conversation extends EventEmitter {
|
|
|
110
106
|
setVolume(volume: number): void;
|
|
111
107
|
updateStatisticsInterval(): void;
|
|
112
108
|
private _openTransport;
|
|
109
|
+
private _allocateParticipantTransport;
|
|
113
110
|
private _close;
|
|
114
111
|
destroy(): Promise<void>;
|
|
115
112
|
private _getConversationParams;
|
|
116
113
|
private _setConversationParams;
|
|
117
|
-
private
|
|
114
|
+
private _buildSignalingEndpoint;
|
|
115
|
+
private _clearCalleeUnavailableWatchdog;
|
|
118
116
|
/**
|
|
119
117
|
* @throws ErrorEvent
|
|
120
118
|
*/
|
|
@@ -129,6 +127,7 @@ export default class Conversation extends EventEmitter {
|
|
|
129
127
|
private _prepareConversation;
|
|
130
128
|
private _createParticipant;
|
|
131
129
|
private _getParticipantId;
|
|
130
|
+
private _cacheParticipantExternalIds;
|
|
132
131
|
private _setConversation;
|
|
133
132
|
private _updateConversation;
|
|
134
133
|
private _createMediaSource;
|
|
@@ -141,10 +140,16 @@ export default class Conversation extends EventEmitter {
|
|
|
141
140
|
private _registerParticipants;
|
|
142
141
|
/** Установим состояние локальных мьютов */
|
|
143
142
|
private _registerParticipantLocalMuteState;
|
|
144
|
-
private
|
|
143
|
+
private _remoteParticipantSessionState;
|
|
144
|
+
private _buildConnectionStatus;
|
|
145
|
+
private _isParticipantSessionStateApplicable;
|
|
146
|
+
private _setTransportStatus;
|
|
147
|
+
private _setSessionState;
|
|
148
|
+
private _emitParticipantTransition;
|
|
145
149
|
private _registerParticipantInCache;
|
|
146
150
|
private _getExistedParticipantByIdOrCreate;
|
|
147
151
|
private _getExternalIdByParticipantId;
|
|
152
|
+
private _getExternalIdsByOkIdsFromCache;
|
|
148
153
|
private _registerParticipantAndSetMarkersIfChunkEnabled;
|
|
149
154
|
private _warnParticipantNotInConversation;
|
|
150
155
|
private _denormalizeMarkers;
|
|
@@ -181,6 +186,10 @@ export default class Conversation extends EventEmitter {
|
|
|
181
186
|
private _cleanupParticipants;
|
|
182
187
|
private _cleanupParticipantAgnosticStreams;
|
|
183
188
|
private _cleanupTransport;
|
|
189
|
+
private _finishLifecycle;
|
|
190
|
+
private _getFirstMediaSentCallback;
|
|
191
|
+
private _stopFirstMediaSentProbe;
|
|
192
|
+
private _cleanupTransportForHold;
|
|
184
193
|
private _cleanupSpeakerDetector;
|
|
185
194
|
private _cleanupSpecListener;
|
|
186
195
|
private _cleanupSignaling;
|
|
@@ -208,15 +217,18 @@ export default class Conversation extends EventEmitter {
|
|
|
208
217
|
*/
|
|
209
218
|
changePriorities(priorities: ParticipantPriority[]): Promise<void>;
|
|
210
219
|
changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<void>;
|
|
211
|
-
hold(hold: boolean): Promise<void>;
|
|
220
|
+
hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
|
|
221
|
+
private _holdLocally;
|
|
222
|
+
private _resumeLocalMedia;
|
|
223
|
+
private _restoreStateAfterHold;
|
|
224
|
+
private _isWaitingForPromotion;
|
|
225
|
+
private _getWaitingForPromotionStatus;
|
|
212
226
|
putHandsDown(): Promise<void>;
|
|
213
227
|
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
|
|
214
228
|
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
|
|
215
229
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
216
230
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
217
231
|
feedback(key: string): Promise<SignalingMessage>;
|
|
218
|
-
userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
|
|
219
|
-
sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
|
|
220
232
|
private _changeMediaSettings;
|
|
221
233
|
private _stopStreaming;
|
|
222
234
|
/**
|
|
@@ -226,8 +238,6 @@ export default class Conversation extends EventEmitter {
|
|
|
226
238
|
private _sendUpdateDisplayLayout;
|
|
227
239
|
private _cleanupCooldownQueue;
|
|
228
240
|
private _onParticipantSourcesUpdate;
|
|
229
|
-
private _clearVideoStreamDebugParticipant;
|
|
230
|
-
private _registerVideoStreamDebugParticipant;
|
|
231
241
|
private _onParticipantPromoted;
|
|
232
242
|
private _onChatRoomUpdated;
|
|
233
243
|
private _onSharedMovieUpdate;
|
|
@@ -314,11 +324,17 @@ export default class Conversation extends EventEmitter {
|
|
|
314
324
|
private _changeMultipleParticipantState;
|
|
315
325
|
private _invokeRolesChangedCallbackIfNeeded;
|
|
316
326
|
private _onSignalingNotification;
|
|
327
|
+
private _onSignalingTopologyChanged;
|
|
317
328
|
private _onPromotionApproved;
|
|
318
329
|
private _onSignalingReconnect;
|
|
319
330
|
private _onSignalingFailed;
|
|
320
331
|
private _onAcceptedCall;
|
|
321
332
|
private _onHungup;
|
|
333
|
+
private _onSessionState;
|
|
334
|
+
private _reconcileParticipantSessionStates;
|
|
335
|
+
private _updateParticipantExternalId;
|
|
336
|
+
private _updateParticipantSessionState;
|
|
337
|
+
private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
|
|
322
338
|
private _onAddedParticipant;
|
|
323
339
|
private _onJoinedParticipant;
|
|
324
340
|
private _onClosedConversation;
|
|
@@ -355,8 +371,8 @@ export default class Conversation extends EventEmitter {
|
|
|
355
371
|
private _onPinParticipant;
|
|
356
372
|
private _onOptionsChanged;
|
|
357
373
|
private _onNetworkStatus;
|
|
374
|
+
private _emitHeldParticipantsStatus;
|
|
358
375
|
private _onRemoteStreamSecond;
|
|
359
|
-
private _onDataChannelScreenStreamDebug;
|
|
360
376
|
/**
|
|
361
377
|
* Коллбек, вызывающийся при получении/остановке стрима от AnimojiReceiver
|
|
362
378
|
* @param participantId - участник, к которому относится стрим
|
|
@@ -376,6 +392,7 @@ export default class Conversation extends EventEmitter {
|
|
|
376
392
|
private _onSpeakerChanged;
|
|
377
393
|
private _onTransportStateChanged;
|
|
378
394
|
private _onTransportLocalStateChanged;
|
|
395
|
+
private _areTransportParticipantsOnHold;
|
|
379
396
|
private _onRemoteTrackAdded;
|
|
380
397
|
private _onRemoteTrackRemoved;
|
|
381
398
|
private _removeAudioTrack;
|
|
@@ -384,9 +401,6 @@ export default class Conversation extends EventEmitter {
|
|
|
384
401
|
private _onAudioMixStall;
|
|
385
402
|
private _onRemoteSignalledStall;
|
|
386
403
|
private _onRemoteDataStats;
|
|
387
|
-
private _onVideoStreamDebug;
|
|
388
|
-
private _resolveVideoStreamDebugMediaType;
|
|
389
|
-
private _resolveVideoStreamDebugParticipantId;
|
|
390
404
|
private _fixAudioDevice;
|
|
391
405
|
private _fixVideoDevice;
|
|
392
406
|
private _toggleJoinAvailability;
|
|
@@ -408,6 +422,7 @@ export default class Conversation extends EventEmitter {
|
|
|
408
422
|
private _onFeedback;
|
|
409
423
|
private _onDecorativeParticipantIdChanged;
|
|
410
424
|
private _onVideoSuspendSuggest;
|
|
425
|
+
private _onParticipantHold;
|
|
411
426
|
private _isMe;
|
|
412
427
|
private _getMuteStatesForRoomId;
|
|
413
428
|
private _getMuteStatesForCurrentRoom;
|
|
@@ -417,6 +432,8 @@ export default class Conversation extends EventEmitter {
|
|
|
417
432
|
private _getParticipants;
|
|
418
433
|
private _getParticipant;
|
|
419
434
|
}
|
|
435
|
+
declare function _resetPendingInstance(): void;
|
|
436
|
+
export { _resetPendingInstance };
|
|
420
437
|
export declare class UpdateDisplayLayoutError extends Error {
|
|
421
438
|
readonly participantErrors: {
|
|
422
439
|
externalId: ExternalParticipantId;
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
47
47
|
/** Трек аудио эффектов. Не изменяется на протяжении всего времени */
|
|
48
48
|
private _audioEffectsTrack;
|
|
49
49
|
private _mediaSettings;
|
|
50
|
+
private _lastMediaSettings;
|
|
50
51
|
private _videoStatusOnScreenCapturingEnabled;
|
|
51
52
|
private _effect;
|
|
52
53
|
private _audioEffectParams;
|
|
@@ -67,7 +68,11 @@ export declare class MediaSource extends EventEmitter {
|
|
|
67
68
|
getSendAudioTrack(): MediaStreamTrack | null;
|
|
68
69
|
get isAnimojiRequested(): boolean;
|
|
69
70
|
addTrackToPeerConnection(pc: RTCPeerConnection, observer: boolean, noDataChannel: boolean): void;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Используйте гетер mediaSettings
|
|
73
|
+
*/
|
|
70
74
|
getMediaSettings(): MediaSettings;
|
|
75
|
+
get mediaSettings(): MediaSettings;
|
|
71
76
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
72
77
|
/**
|
|
73
78
|
* Установка кастомного стрима для видео, например внешний шаринг экрана
|
|
@@ -95,6 +100,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
95
100
|
private _setEffect;
|
|
96
101
|
private _stopEffect;
|
|
97
102
|
destroy(): void;
|
|
103
|
+
stopLocalMedia(): Promise<void>;
|
|
104
|
+
resumeLocalMedia(lastActiveMediaSettings?: MediaSettings): Promise<void>;
|
|
98
105
|
toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
|
|
99
106
|
disableScreenCapturing(): Promise<void>;
|
|
100
107
|
private videoTrackMuteHandler;
|
|
@@ -12,12 +12,17 @@ export default class SpecListener extends EventEmitter {
|
|
|
12
12
|
private readonly _debug;
|
|
13
13
|
private readonly _logger;
|
|
14
14
|
private _connectionTimeout;
|
|
15
|
+
private _connectionTimeoutSuppressed;
|
|
15
16
|
private _volumeTimeout;
|
|
16
17
|
constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?: StatsLogger | null);
|
|
17
18
|
destroy(): void;
|
|
18
19
|
onChangeRemoteMediaSettings(participantId: ParticipantId, mediaSettings: MediaSettings): void;
|
|
20
|
+
onParticipantHoldChanged(): void;
|
|
21
|
+
private _getConnectionTimeout;
|
|
22
|
+
private _getVolumeTimeout;
|
|
19
23
|
private _onTransportStateChanged;
|
|
20
24
|
private _onVolumesDetected;
|
|
21
25
|
private _onConnectionTimeout;
|
|
26
|
+
private _reportConnectionTimeout;
|
|
22
27
|
private _onVolumeTimeout;
|
|
23
28
|
}
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import BaseApi from '../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../enums/StatLog';
|
|
4
|
+
import TransportTopology from '../enums/TransportTopology';
|
|
5
|
+
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
6
|
+
export type LogClientStatsOptions = {
|
|
7
|
+
immediately?: boolean;
|
|
8
|
+
occurredAt?: number;
|
|
9
|
+
conversationId?: string | null;
|
|
10
|
+
deferUntilServerTime?: boolean;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* Класс отвечает за отправку различной информации в сервис статистики (события, статистика и подобное)
|
|
6
14
|
*/
|
|
@@ -8,22 +16,26 @@ export default class StatsLogger extends BaseLogger {
|
|
|
8
16
|
private readonly _externalLogger;
|
|
9
17
|
private readonly _api;
|
|
10
18
|
private readonly _conversationIdProvider;
|
|
19
|
+
private readonly _topologyProvider;
|
|
11
20
|
private readonly _batchInterval;
|
|
12
21
|
private _batchedClientStats;
|
|
13
|
-
private _batchedClientEvents;
|
|
14
22
|
private _batchTimeout;
|
|
15
23
|
private _serverTimeDelta;
|
|
16
|
-
|
|
24
|
+
private _waitingForServerTime;
|
|
25
|
+
private _deferredClientStats;
|
|
26
|
+
constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null, topologyProvider?: () => TransportTopology | undefined);
|
|
17
27
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
18
|
-
logClientStats(data:
|
|
19
|
-
logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
|
|
28
|
+
logClientStats(data: ClientStatsPayload, immediatelyOrOptions?: boolean | LogClientStatsOptions): void;
|
|
20
29
|
destroy(): void;
|
|
30
|
+
private _logClientStats;
|
|
21
31
|
private _getConversationId;
|
|
32
|
+
private _getCallTopology;
|
|
22
33
|
private _sendBatch;
|
|
23
34
|
private _startTimeout;
|
|
24
35
|
private _stopTimeout;
|
|
25
36
|
private _sendClientStats;
|
|
26
|
-
private _sendClientEvents;
|
|
27
37
|
private _calculateServerTimeDelta;
|
|
38
|
+
private _flushDeferredClientStats;
|
|
28
39
|
private _now;
|
|
29
40
|
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import HangupReason from '../HangupReason';
|
|
2
|
+
import StatsLogger from '../StatsLogger';
|
|
3
|
+
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
4
|
+
export interface CallLifecycleInitializationParams {
|
|
5
|
+
source: CallLifecycleSource;
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CallLifecycleClock {
|
|
9
|
+
wallNow(): number;
|
|
10
|
+
monotonicNow(): number;
|
|
11
|
+
}
|
|
12
|
+
export declare class CallLifecycleStats {
|
|
13
|
+
private readonly _logger;
|
|
14
|
+
private readonly _clock;
|
|
15
|
+
private _conversationId;
|
|
16
|
+
private _callStartLabel;
|
|
17
|
+
private _lifecycleStartedAtMonotonic;
|
|
18
|
+
private _warmupStartedAtMonotonic;
|
|
19
|
+
private _pendingEvents;
|
|
20
|
+
private _warmupCompleted;
|
|
21
|
+
private _callStarted;
|
|
22
|
+
private _accepted;
|
|
23
|
+
private _firstMediaSent;
|
|
24
|
+
private _finished;
|
|
25
|
+
private _destroyed;
|
|
26
|
+
constructor(logger: StatsLogger, clock?: CallLifecycleClock);
|
|
27
|
+
get firstMediaSentReported(): boolean;
|
|
28
|
+
get terminated(): boolean;
|
|
29
|
+
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
30
|
+
bindConversationId(conversationId: string): void;
|
|
31
|
+
markWarmupStarted(): void;
|
|
32
|
+
markWarmupCompleted(): void;
|
|
33
|
+
markCallStarted(): void;
|
|
34
|
+
markOutgoingAccepted(): void;
|
|
35
|
+
markIncomingAccepted(concurrent: boolean): void;
|
|
36
|
+
markFirstMediaSent(): void;
|
|
37
|
+
markFinished(reason: HangupReason): void;
|
|
38
|
+
markTerminated(): void;
|
|
39
|
+
destroy(): void;
|
|
40
|
+
private _canRecord;
|
|
41
|
+
private _durationSince;
|
|
42
|
+
private _finish;
|
|
43
|
+
private _ensureConversationId;
|
|
44
|
+
private _record;
|
|
45
|
+
private _flushPendingEvents;
|
|
46
|
+
private _logEvent;
|
|
47
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import BaseApi from '../../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
3
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
3
4
|
import HangupReason from '../HangupReason';
|
|
4
5
|
import StatsLogger from '../StatsLogger';
|
|
5
|
-
import
|
|
6
|
+
import { CallLifecycleStats } from './CallLifecycleStats';
|
|
6
7
|
import { CodecStatsAggregator } from './CodecStatsAggregator';
|
|
7
8
|
import { StatAggregator } from './StatAggregator';
|
|
8
9
|
import { StatPings } from './StatPings';
|
|
9
10
|
import { StatSignalingCommands } from './StatSignalingCommands';
|
|
10
11
|
export declare class ConversationStats {
|
|
11
12
|
readonly logger: StatsLogger;
|
|
13
|
+
readonly lifecycle: CallLifecycleStats;
|
|
12
14
|
readonly statAggregator: StatAggregator;
|
|
13
15
|
readonly codecStatsAggregator: CodecStatsAggregator;
|
|
14
16
|
readonly pings: StatPings;
|
|
15
17
|
readonly signalingCommands: StatSignalingCommands;
|
|
16
18
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined);
|
|
17
|
-
logHangup(reason: HangupReason
|
|
18
|
-
flushCallMetrics(
|
|
19
|
+
logHangup(reason: HangupReason): void;
|
|
20
|
+
flushCallMetrics(): void;
|
|
19
21
|
destroy(): void;
|
|
20
|
-
private static correctHangupReason;
|
|
21
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class FirstMediaSentProbe {
|
|
2
|
+
private readonly _peerConnection;
|
|
3
|
+
private readonly _onFirstMediaSent;
|
|
4
|
+
private readonly _pollIntervalMs;
|
|
5
|
+
private _timer;
|
|
6
|
+
private _state;
|
|
7
|
+
constructor(peerConnection: RTCPeerConnection, onFirstMediaSent: () => void, pollIntervalMs?: number);
|
|
8
|
+
start(): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
private _getStatsReports;
|
|
11
|
+
private _poll;
|
|
12
|
+
private _scheduleNextPoll;
|
|
13
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatPings {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByTransport;
|
|
@@ -12,6 +11,6 @@ export declare class StatPings {
|
|
|
12
11
|
*/
|
|
13
12
|
mark(transport: SignalingTransportType): void;
|
|
14
13
|
/** Отправляем данные в стату */
|
|
15
|
-
logMetrics(
|
|
14
|
+
logMetrics(): void;
|
|
16
15
|
destroy(): void;
|
|
17
16
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatSignalingCommands {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByCommand;
|
|
7
6
|
constructor(logger: StatsLogger);
|
|
8
7
|
mark(command: string, time: number, transport: SignalingTransportType): void;
|
|
9
8
|
/** Отправляем данные в стату */
|
|
10
|
-
logMetrics(
|
|
9
|
+
logMetrics(): void;
|
|
11
10
|
destroy(): void;
|
|
12
11
|
}
|
|
@@ -7,7 +7,13 @@ export default abstract class BaseTransport extends EventEmitter {
|
|
|
7
7
|
protected readonly _mediaSource: MediaSource;
|
|
8
8
|
protected _state: TransportState;
|
|
9
9
|
protected _pc: RTCPeerConnection | null;
|
|
10
|
-
|
|
10
|
+
private readonly _onFirstMediaSent;
|
|
11
|
+
private _firstMediaSentProbe;
|
|
12
|
+
private _firstMediaSentProbeStopped;
|
|
13
|
+
protected constructor(signaling: BaseSignaling, mediaSource: MediaSource, onFirstMediaSent?: (() => void) | null);
|
|
11
14
|
getState(): TransportState;
|
|
15
|
+
stopFirstMediaSentProbe(): void;
|
|
12
16
|
abstract close(error?: Error): void;
|
|
17
|
+
protected _startFirstMediaSentProbe(): void;
|
|
18
|
+
protected _disposeFirstMediaSentProbe(): void;
|
|
13
19
|
}
|
|
@@ -11,11 +11,6 @@ import BaseTransport from './BaseTransport';
|
|
|
11
11
|
export default class DirectTransport extends BaseTransport {
|
|
12
12
|
private readonly _participantId;
|
|
13
13
|
private readonly _isMaster;
|
|
14
|
-
private _hasOutboundVideoDebug;
|
|
15
|
-
private _hasInboundVideoDebug;
|
|
16
|
-
private _outboundVideoDebugMediaType;
|
|
17
|
-
private _inboundVideoDebugMediaType;
|
|
18
|
-
private _videoDebugBytes;
|
|
19
14
|
private _remoteSDP;
|
|
20
15
|
private _remoteCandidates;
|
|
21
16
|
private _lastRemoteSDP;
|
|
@@ -32,6 +27,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
32
27
|
private _iceRestartTimeout;
|
|
33
28
|
private _reconnectionTimeout;
|
|
34
29
|
private _reconnectionPrevented;
|
|
30
|
+
private _remoteHold;
|
|
35
31
|
private _lastStat;
|
|
36
32
|
private _fingerprint;
|
|
37
33
|
private _neverConnected;
|
|
@@ -47,7 +43,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
47
43
|
private readonly _logger;
|
|
48
44
|
private readonly _statAggregator;
|
|
49
45
|
private readonly _codecStatsAggregator;
|
|
50
|
-
constructor(participantId: ParticipantId, isMaster: boolean, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
46
|
+
constructor(participantId: ParticipantId, isMaster: boolean, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
51
47
|
get participantId(): ParticipantId;
|
|
52
48
|
updateStatisticsInterval(): void;
|
|
53
49
|
private _isDeadConnection;
|
|
@@ -55,6 +51,10 @@ export default class DirectTransport extends BaseTransport {
|
|
|
55
51
|
updateSettings(settings: ServerSettings): void;
|
|
56
52
|
preventRestart(): void;
|
|
57
53
|
allowRestart(): void;
|
|
54
|
+
setRemoteHold(hold: boolean): void;
|
|
55
|
+
private _recreatePeerConnection;
|
|
56
|
+
private _createPeerConnection;
|
|
57
|
+
private _disposePeerConnection;
|
|
58
58
|
setAnimojiTransport(receiver: AnimojiReceiver, sender: AnimojiSender): void;
|
|
59
59
|
close(error?: Error): void;
|
|
60
60
|
private _setState;
|
|
@@ -80,11 +80,6 @@ export default class DirectTransport extends BaseTransport {
|
|
|
80
80
|
private static _patchRemoteDescription;
|
|
81
81
|
private _onReplacedTrack;
|
|
82
82
|
private _startStatInterval;
|
|
83
|
-
private _reportVideoStreamDebug;
|
|
84
|
-
private _isOutboundVideoDebugEnabled;
|
|
85
|
-
private _clearOutboundVideoDebug;
|
|
86
|
-
private _getVideoDebugMediaType;
|
|
87
|
-
private _getVideoDebugBitrate;
|
|
88
83
|
/**
|
|
89
84
|
* Check SVC support
|
|
90
85
|
* @see https://webrtc.internaut.com/mc/
|
|
@@ -9,9 +9,6 @@ import { CodecStatsAggregator } from '../stat/CodecStatsAggregator';
|
|
|
9
9
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
10
10
|
import BaseTransport from './BaseTransport';
|
|
11
11
|
export default class ServerTransport extends BaseTransport {
|
|
12
|
-
private _outboundVideoDebugMediaTypes;
|
|
13
|
-
private _inboundVideoDebugParticipants;
|
|
14
|
-
private _videoDebugBytes;
|
|
15
12
|
private _producerNotification;
|
|
16
13
|
private _producerCommand;
|
|
17
14
|
private _producerScreen;
|
|
@@ -43,7 +40,6 @@ export default class ServerTransport extends BaseTransport {
|
|
|
43
40
|
private _participantIdRegistry;
|
|
44
41
|
private _disabledSenders;
|
|
45
42
|
private _rtpReceiversByStreamId;
|
|
46
|
-
private _participantIdByVideoTrackId;
|
|
47
43
|
private _producerSessionId;
|
|
48
44
|
private _newAudioShareTrack;
|
|
49
45
|
private _simulcastInfo;
|
|
@@ -51,7 +47,7 @@ export default class ServerTransport extends BaseTransport {
|
|
|
51
47
|
private readonly _logger;
|
|
52
48
|
private readonly _statAggregator;
|
|
53
49
|
private readonly _codecStatsAggregator;
|
|
54
|
-
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
50
|
+
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
55
51
|
updateStatisticsInterval(): void;
|
|
56
52
|
open(observer?: boolean): void;
|
|
57
53
|
close(error?: Error): void;
|
|
@@ -86,16 +82,6 @@ export default class ServerTransport extends BaseTransport {
|
|
|
86
82
|
private _stopSettingsInterval;
|
|
87
83
|
private _collectStat;
|
|
88
84
|
private _reportStats;
|
|
89
|
-
private _reportVideoStreamDebug;
|
|
90
|
-
private _isOutboundVideoDebugEnabled;
|
|
91
|
-
private _getOutboundVideoDebugMediaType;
|
|
92
|
-
private _getOutboundVideoDebugTrack;
|
|
93
|
-
private _getVideoDebugStreamId;
|
|
94
|
-
private _getVideoDebugTrackId;
|
|
95
|
-
private _createVideoDebugLayer;
|
|
96
|
-
private _getScreenShareDebugMethod;
|
|
97
|
-
private _sumVideoDebugBitrate;
|
|
98
|
-
private _getVideoDebugBitrate;
|
|
99
85
|
private _detectStaleTracks;
|
|
100
86
|
private _allocateConsumer;
|
|
101
87
|
private _processOffer;
|
|
@@ -3,9 +3,7 @@ import BaseSignaling from '../../abstract/BaseSignaling';
|
|
|
3
3
|
import TransportState from '../../enums/TransportState';
|
|
4
4
|
import TransportTopology from '../../enums/TransportTopology';
|
|
5
5
|
import { type DebugLogger } from '../../static/Debug';
|
|
6
|
-
import { VideoStreamDebugDirection, type VideoStreamDebugLayer } from '../../static/DebugVideoStats';
|
|
7
6
|
import { ParticipantId } from '../../types/Participant';
|
|
8
|
-
import type { MediaType } from '../../types/ParticipantStreamDescription';
|
|
9
7
|
import ServerSettings from '../../types/ServerSettings';
|
|
10
8
|
import EventEmitter from '../EventEmitter';
|
|
11
9
|
import StatsLogger from '../StatsLogger';
|
|
@@ -29,24 +27,8 @@ export declare const enum TransportEvent {
|
|
|
29
27
|
ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION",
|
|
30
28
|
ANIMOJI_STREAM = "ANIMOJI_STREAM",
|
|
31
29
|
ANIMOJI_ERROR = "ANIMOJI_ERROR",
|
|
32
|
-
SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT"
|
|
33
|
-
VIDEO_STREAM_DEBUG = "VIDEO_STREAM_DEBUG"
|
|
30
|
+
SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT"
|
|
34
31
|
}
|
|
35
|
-
export type VideoStreamDebugEvent = {
|
|
36
|
-
direction: VideoStreamDebugDirection;
|
|
37
|
-
mediaType?: MediaType.CAMERA | MediaType.SCREEN;
|
|
38
|
-
streamId?: ParticipantId;
|
|
39
|
-
trackId?: string;
|
|
40
|
-
mimeType?: string;
|
|
41
|
-
width?: number;
|
|
42
|
-
height?: number;
|
|
43
|
-
frameRate?: number;
|
|
44
|
-
bitrate?: number;
|
|
45
|
-
packetsLost?: number;
|
|
46
|
-
screenShareMethod?: string;
|
|
47
|
-
layers?: VideoStreamDebugLayer[];
|
|
48
|
-
clear?: boolean;
|
|
49
|
-
};
|
|
50
32
|
export declare class Transport extends EventEmitter {
|
|
51
33
|
private readonly _signaling;
|
|
52
34
|
private readonly _mediaSource;
|
|
@@ -66,13 +48,18 @@ export declare class Transport extends EventEmitter {
|
|
|
66
48
|
private readonly _logger;
|
|
67
49
|
private readonly _statAggregator;
|
|
68
50
|
private readonly _codecStatsAggregator;
|
|
69
|
-
|
|
51
|
+
private readonly _onFirstMediaSent;
|
|
52
|
+
private _firstMediaSentProbeStopped;
|
|
53
|
+
constructor(topology: TransportTopology, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
70
54
|
updateSettings(settings: ServerSettings): void;
|
|
71
55
|
updateStatisticsInterval(): void;
|
|
72
56
|
allocate(participantId: ParticipantId, isMaster?: boolean): void;
|
|
73
57
|
open(participantIds: ParticipantId[], peerId?: string | null, observer?: boolean, force?: boolean): void;
|
|
74
58
|
close(participantId: ParticipantId): void;
|
|
75
59
|
destroy(): void;
|
|
60
|
+
stopFirstMediaSentProbe(): void;
|
|
61
|
+
holdClose(): void;
|
|
62
|
+
setRemoteHold(hold: boolean): void;
|
|
76
63
|
getTopology(): TransportTopology;
|
|
77
64
|
isAllocated(participantId: ParticipantId): boolean;
|
|
78
65
|
allocated(): string[];
|
|
@@ -85,6 +72,8 @@ export declare class Transport extends EventEmitter {
|
|
|
85
72
|
private _setStates;
|
|
86
73
|
private _setLocalState;
|
|
87
74
|
private _onSignalingNotification;
|
|
75
|
+
private _handleFirstMediaSent;
|
|
76
|
+
private _getFirstMediaSentCallback;
|
|
88
77
|
private _onTopologyChanged;
|
|
89
78
|
private _createDirectTransport;
|
|
90
79
|
private _createServerTransport;
|
|
@@ -100,7 +89,6 @@ export declare class Transport extends EventEmitter {
|
|
|
100
89
|
private _onPeerConnectionClosed;
|
|
101
90
|
private _onServerAudioMixStall;
|
|
102
91
|
private _onRemoteDataStats;
|
|
103
|
-
private _onVideoStreamDebug;
|
|
104
92
|
private _onRemoteTrackAdded;
|
|
105
93
|
private _onRemoteTrackRemoved;
|
|
106
94
|
private _onAsrTranscription;
|