@vkontakte/calls-sdk 2.8.13-dev.9394b771.0 → 2.8.13-dev.939924e7.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 +8 -4
- package/abstract/BaseApi.d.ts +1 -1
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +2470 -2088
- package/classes/AudioOutput.d.ts +2 -0
- package/classes/CallRegistry.d.ts +17 -4
- package/classes/MediaSource.d.ts +5 -0
- package/classes/SignalingErrors.d.ts +6 -0
- package/classes/StatsLogger.d.ts +1 -1
- package/classes/conversation/Conversation.d.ts +26 -10
- package/classes/conversation/Conversation.testUtils.d.ts +1 -0
- package/classes/screenshare/ScreenCaptureSender.d.ts +2 -2
- package/classes/stat/BatteryStats.d.ts +25 -0
- package/classes/stat/ClientResourceStats.d.ts +41 -0
- package/classes/stat/ConversationStats.d.ts +5 -1
- package/classes/stat/SdpStats.d.ts +2 -1
- package/classes/stat/StatAggregator.d.ts +3 -1
- package/classes/stat/StatEventCollector.d.ts +1 -1
- package/classes/stat/StatQueue.d.ts +2 -2
- package/classes/transport/BaseTransport.d.ts +3 -3
- package/classes/transport/DirectStatReporter.d.ts +2 -2
- package/classes/transport/DirectTransport.d.ts +2 -2
- package/classes/transport/PerfStatReporter.d.ts +7 -3
- package/classes/transport/ServerTransport.d.ts +4 -2
- package/classes/transport/SimulcastSender.d.ts +2 -2
- package/classes/transport/Transport.d.ts +2 -2
- package/default/Api.d.ts +3 -0
- package/default/Signaling.d.ts +9 -16
- package/default/SignalingSession.d.ts +92 -0
- package/enums/ActiveFeature.d.ts +19 -0
- package/package.json +3 -3
- package/static/AuthData.d.ts +11 -1
- package/static/External.d.ts +4 -0
- package/static/Params.d.ts +42 -11
- package/types/AddParticipantParams.d.ts +18 -0
- package/types/ClientStatsEvent.d.ts +2 -1
- package/types/FastHangup.d.ts +7 -5
- package/types/PerfStatReporter.d.ts +25 -1
- package/types/SignalingMessage.d.ts +2 -0
- package/types/Statistics.d.ts +22 -7
- package/abstract/BaseSignaling.d.ts +0 -143
- package/default/SignalingTransport.d.ts +0 -80
package/classes/AudioOutput.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export default class AudioOutput {
|
|
|
15
15
|
private readonly _features;
|
|
16
16
|
private readonly _statFirstMediaReceived;
|
|
17
17
|
private readonly _logger;
|
|
18
|
+
private _autoplayRecoveryController;
|
|
18
19
|
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
20
|
add(participantId: ParticipantId, track: MediaStreamTrack): void;
|
|
20
21
|
remove(participantId: ParticipantId, track: MediaStreamTrack): void;
|
|
@@ -26,6 +27,7 @@ export default class AudioOutput {
|
|
|
26
27
|
protected _getTracks(): MediaStreamTrack[];
|
|
27
28
|
protected _initAudioElement(): void;
|
|
28
29
|
protected _stopAudioElement(): void;
|
|
30
|
+
private _stopAutoplayRecovery;
|
|
29
31
|
private _createAudioElement;
|
|
30
32
|
private _prepareAudioElement;
|
|
31
33
|
private _addTrackToAudioElement;
|
|
@@ -6,18 +6,31 @@ export interface HoldableConversation extends Conversation {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CallRegistry {
|
|
8
8
|
private _conversations;
|
|
9
|
-
private
|
|
9
|
+
private _pending;
|
|
10
|
+
private _initialIds;
|
|
11
|
+
private _hangups;
|
|
10
12
|
private _activeId;
|
|
13
|
+
private _selected;
|
|
11
14
|
private _mutex;
|
|
12
15
|
private _pendingRemovals;
|
|
13
|
-
|
|
16
|
+
addPending(conversation: HoldableConversation): void;
|
|
17
|
+
selectPending(conversation: HoldableConversation): HoldableConversation | null;
|
|
18
|
+
isSelected(conversation: HoldableConversation): boolean;
|
|
19
|
+
releaseSelection(conversation: HoldableConversation, previous?: HoldableConversation | null): void;
|
|
20
|
+
selectIfNone(conversation: HoldableConversation): void;
|
|
14
21
|
add(conversation: HoldableConversation): void;
|
|
15
|
-
remove(
|
|
22
|
+
remove(conversation: HoldableConversation): void;
|
|
16
23
|
get(id: string): HoldableConversation | undefined;
|
|
24
|
+
getPending(id?: string): HoldableConversation | null;
|
|
25
|
+
isPending(conversation: HoldableConversation): boolean;
|
|
26
|
+
getLocal(id?: string): HoldableConversation | null;
|
|
27
|
+
trackHangup(conversation: HoldableConversation, promise: Promise<void>): void;
|
|
28
|
+
getHangup(id?: string): Promise<void> | undefined;
|
|
29
|
+
removeHangup(promise: Promise<void>): void;
|
|
17
30
|
getActive(): HoldableConversation | null;
|
|
18
31
|
getFirst(): HoldableConversation | null;
|
|
19
32
|
getActiveId(): string | null;
|
|
20
|
-
has(id: string): boolean;
|
|
33
|
+
has(id: string, except?: HoldableConversation): boolean;
|
|
21
34
|
getAll(): HoldableConversation[];
|
|
22
35
|
get callsLength(): number;
|
|
23
36
|
setActive(id: string): Promise<void>;
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
2
2
|
import EventEmitter from '../classes/EventEmitter';
|
|
3
|
+
import ActiveFeature from '../enums/ActiveFeature';
|
|
3
4
|
import MediaOption from '../enums/MediaOption';
|
|
4
5
|
import { type DebugLogger } from '../static/Debug';
|
|
5
6
|
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
@@ -38,6 +39,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
38
39
|
private _screenTrack;
|
|
39
40
|
private _audioShareTrack;
|
|
40
41
|
private _screenShareTrack;
|
|
42
|
+
private _screenCaptureRequest;
|
|
43
|
+
private _destroyed;
|
|
41
44
|
/** Трек для отправки в медиа-канал. Может отличаться при скриншаринге в дата-канал */
|
|
42
45
|
private _sendVideoTrack;
|
|
43
46
|
/** Трек с камеры. В стриме будет другой трек при включенных видео эффектах */
|
|
@@ -77,6 +80,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
77
80
|
*/
|
|
78
81
|
getMediaSettings(): MediaSettings;
|
|
79
82
|
get mediaSettings(): MediaSettings;
|
|
83
|
+
/** Что сейчас включено у пользователя — для метрики active_features */
|
|
84
|
+
get activeFeatures(): ActiveFeature[];
|
|
80
85
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
81
86
|
/**
|
|
82
87
|
* Установка кастомного стрима для видео, например внешний шаринг экрана
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import BaseApi from '../abstract/BaseApi';
|
|
|
2
2
|
import BaseLogger from '../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../enums/StatLog';
|
|
4
4
|
import TransportTopology from '../enums/TransportTopology';
|
|
5
|
-
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
5
|
+
type ClientStatsPayload = Record<string, string | string[] | number | boolean | undefined | null>;
|
|
6
6
|
export type LogClientStatsOptions = {
|
|
7
7
|
immediately?: boolean;
|
|
8
8
|
occurredAt?: number;
|
|
@@ -2,7 +2,7 @@ import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
|
2
2
|
import type { RGBTuple } from '@vkontakte/calls-vmoji';
|
|
3
3
|
import BaseApi from '../../abstract/BaseApi';
|
|
4
4
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
5
|
-
import { AddParticipantParams } from '../../
|
|
5
|
+
import type { AddParticipantParams } from '../../types/AddParticipantParams';
|
|
6
6
|
import ConversationFeature from '../../enums/ConversationFeature';
|
|
7
7
|
import ConversationOption from '../../enums/ConversationOption';
|
|
8
8
|
import MediaOption from '../../enums/MediaOption';
|
|
@@ -15,7 +15,7 @@ import { IAsrStartParams, IAsrStopParams } from '../../types/Asr';
|
|
|
15
15
|
import { AudienceModeHandsResponse } from '../../types/AudienceMode';
|
|
16
16
|
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../../types/Conversation';
|
|
17
17
|
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../../types/ExternalId';
|
|
18
|
-
import type {
|
|
18
|
+
import type { HangupParams } from '../../types/FastHangup';
|
|
19
19
|
import MediaModifiers from '../../types/MediaModifiers';
|
|
20
20
|
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
21
21
|
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
@@ -35,6 +35,9 @@ export default class Conversation extends EventEmitter {
|
|
|
35
35
|
private readonly _signalingActor;
|
|
36
36
|
private readonly _displayLayoutRequester;
|
|
37
37
|
private _mediaSource;
|
|
38
|
+
private _requestingLocalMedia;
|
|
39
|
+
private _requestedLocalAudio?;
|
|
40
|
+
private _requestedLocalVideo?;
|
|
38
41
|
private _conversation;
|
|
39
42
|
private _myLastRequestedLayouts;
|
|
40
43
|
private _state;
|
|
@@ -56,14 +59,17 @@ export default class Conversation extends EventEmitter {
|
|
|
56
59
|
private _isRealTimeAsrRequested;
|
|
57
60
|
private _serverSettings;
|
|
58
61
|
private _serverTimeOffset;
|
|
59
|
-
private
|
|
62
|
+
private _serverConversationId;
|
|
60
63
|
private _onFastHangup?;
|
|
61
64
|
private _hangupEmitted;
|
|
62
65
|
private _hangupPromise;
|
|
66
|
+
private _hangupReason;
|
|
63
67
|
private _abortController;
|
|
64
68
|
private _registeredPeerReceived;
|
|
65
69
|
private _calleeUnavailableTimer;
|
|
66
|
-
private
|
|
70
|
+
private _pendingId;
|
|
71
|
+
private _resolveSignalingInitialization;
|
|
72
|
+
private readonly _signalingInitialization;
|
|
67
73
|
private readonly _onUnload;
|
|
68
74
|
private readonly _onRestore;
|
|
69
75
|
private readonly _onVisibilityChange;
|
|
@@ -81,7 +87,6 @@ export default class Conversation extends EventEmitter {
|
|
|
81
87
|
private readonly _statFirstMediaReceived;
|
|
82
88
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
83
89
|
static current(): Conversation | null;
|
|
84
|
-
static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
|
|
85
90
|
static id(): string | null;
|
|
86
91
|
get id(): string;
|
|
87
92
|
get externalId(): ExternalParticipantId | undefined;
|
|
@@ -117,7 +122,8 @@ export default class Conversation extends EventEmitter {
|
|
|
117
122
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
118
123
|
decline(params?: HangupParams): Promise<void>;
|
|
119
124
|
hangup(params?: HangupParams): Promise<void>;
|
|
120
|
-
|
|
125
|
+
private _waitForHangup;
|
|
126
|
+
addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<ExternalParticipant[] | undefined>;
|
|
121
127
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
|
|
122
128
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
|
|
123
129
|
setVolume(volume: number): void;
|
|
@@ -125,11 +131,15 @@ export default class Conversation extends EventEmitter {
|
|
|
125
131
|
private _openTransport;
|
|
126
132
|
private _allocateParticipantTransport;
|
|
127
133
|
private _closeParticipantTransport;
|
|
134
|
+
private _registerPending;
|
|
128
135
|
private _cleanupRegistry;
|
|
136
|
+
private _applyInitialActiveSelection;
|
|
129
137
|
private _emitHangupOnce;
|
|
130
138
|
private _sendHangupApi;
|
|
131
139
|
private _close;
|
|
132
140
|
private _sendHangup;
|
|
141
|
+
private _throwIfClosed;
|
|
142
|
+
private _applyServerConversation;
|
|
133
143
|
destroy(): void;
|
|
134
144
|
private _destroy;
|
|
135
145
|
private _getConversationParams;
|
|
@@ -153,12 +163,15 @@ export default class Conversation extends EventEmitter {
|
|
|
153
163
|
private _cacheParticipantExternalIds;
|
|
154
164
|
private _setConversation;
|
|
155
165
|
private _updateConversation;
|
|
166
|
+
private _requestLocalMedia;
|
|
156
167
|
private _createMediaSource;
|
|
157
168
|
private _connectSignaling;
|
|
169
|
+
private _completeSignalingInitialization;
|
|
158
170
|
private _processConnection;
|
|
159
171
|
private _onConversationParticipantListChunk;
|
|
160
172
|
private _createParticipantListChunk;
|
|
161
173
|
private _participantListChunkToExternalChunk;
|
|
174
|
+
private _participantsToExternal;
|
|
162
175
|
private _registerConnectionParticipants;
|
|
163
176
|
private _registerParticipants;
|
|
164
177
|
/** Установим состояние локальных мьютов */
|
|
@@ -251,8 +264,8 @@ export default class Conversation extends EventEmitter {
|
|
|
251
264
|
private _isWaitingForPromotion;
|
|
252
265
|
private _getWaitingForPromotionStatus;
|
|
253
266
|
putHandsDown(): Promise<void>;
|
|
254
|
-
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<
|
|
255
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<
|
|
267
|
+
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<SignalingMessage>;
|
|
268
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<SignalingMessage>;
|
|
256
269
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
257
270
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
258
271
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -453,6 +466,11 @@ export default class Conversation extends EventEmitter {
|
|
|
453
466
|
private _onVideoSuspendSuggest;
|
|
454
467
|
private _onParticipantHold;
|
|
455
468
|
private _isMe;
|
|
469
|
+
/**
|
|
470
|
+
* Сколько человек сейчас в звонке. Считаем только принявших: приглашенные,
|
|
471
|
+
* у которых еще идет вызов, ресурсы не потребляют.
|
|
472
|
+
*/
|
|
473
|
+
private _getParticipantsCount;
|
|
456
474
|
private _getMuteStatesForRoomId;
|
|
457
475
|
private _getMuteStatesForCurrentRoom;
|
|
458
476
|
private _setMuteStatesForRoomId;
|
|
@@ -460,8 +478,6 @@ export default class Conversation extends EventEmitter {
|
|
|
460
478
|
private _registerParticipant;
|
|
461
479
|
private _getParticipant;
|
|
462
480
|
}
|
|
463
|
-
declare function _resetPendingInstance(): void;
|
|
464
|
-
export { _resetPendingInstance };
|
|
465
481
|
export declare class UpdateDisplayLayoutError extends Error {
|
|
466
482
|
readonly participantErrors: {
|
|
467
483
|
externalId: ExternalParticipantId;
|
|
@@ -37,6 +37,7 @@ declare function createParams(): {
|
|
|
37
37
|
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
38
|
onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
|
|
39
39
|
onNonFatalError: Mock<import("@vitest/spy").Procedure>;
|
|
40
|
+
onSignalingConnected: Mock<import("@vitest/spy").Procedure>;
|
|
40
41
|
};
|
|
41
42
|
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
42
43
|
export type ConversationTestTools = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Signaling from '../../default/Signaling';
|
|
2
2
|
import { type DebugLogger } from '../../static/Debug';
|
|
3
3
|
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
export default class ScreenCaptureSender {
|
|
@@ -25,7 +25,7 @@ export default class ScreenCaptureSender {
|
|
|
25
25
|
private readonly _maxFrameDelay;
|
|
26
26
|
private readonly _debug;
|
|
27
27
|
private readonly _logger;
|
|
28
|
-
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling:
|
|
28
|
+
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: Signaling, fastSharing: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
29
29
|
private _handleQueue;
|
|
30
30
|
/**
|
|
31
31
|
* Очищает очередь до опорного кадра
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import StatEventCollector from './StatEventCollector';
|
|
2
|
+
export interface BatteryClock {
|
|
3
|
+
monotonicNow(): number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Метрика battery_level_change: на каждое изменение уровня заряда отправляется
|
|
7
|
+
* само изменение в процентных пунктах и время, за которое оно произошло.
|
|
8
|
+
* Пока устройство на зарядке, замеры не ведутся: зарядка сбрасывает точку отсчёта,
|
|
9
|
+
* и первое изменение после неё только задаёт новую.
|
|
10
|
+
*
|
|
11
|
+
* Battery Status API есть только в Chromium, в Safari и Firefox его нет —
|
|
12
|
+
* там класс молча ничего не делает.
|
|
13
|
+
*/
|
|
14
|
+
export declare class BatteryStats {
|
|
15
|
+
private readonly _logger;
|
|
16
|
+
private readonly _clock;
|
|
17
|
+
private _battery;
|
|
18
|
+
private _previous;
|
|
19
|
+
private _destroyed;
|
|
20
|
+
constructor(logger: StatEventCollector, clock?: BatteryClock);
|
|
21
|
+
destroy(): void;
|
|
22
|
+
private _subscribe;
|
|
23
|
+
private _handleChargingChange;
|
|
24
|
+
private _handleLevelChange;
|
|
25
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import ActiveFeature from '../../enums/ActiveFeature';
|
|
2
|
+
import { type DebugLogger } from '../../static/Debug';
|
|
3
|
+
/** Метрики ресурсов клиента за интервал между отправками callStat */
|
|
4
|
+
export type ClientResourceReport = {
|
|
5
|
+
/** Максимум участников за интервал */
|
|
6
|
+
participants_max?: number;
|
|
7
|
+
/** Фичи, включенные в любой момент интервала */
|
|
8
|
+
active_features?: string[];
|
|
9
|
+
/** Максимальная площадь окна за интервал, в мегапикселях */
|
|
10
|
+
app_total_area_mpx_max?: number;
|
|
11
|
+
};
|
|
12
|
+
export type ClientResourceSources = {
|
|
13
|
+
getParticipantsCount: () => number;
|
|
14
|
+
getActiveFeatures: () => ActiveFeature[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Копит ресурсные метрики между отправками callStat: репортер забирает накопленное
|
|
18
|
+
* через takeReport() и начинает копить заново.
|
|
19
|
+
*
|
|
20
|
+
* Замеряем чаще, чем отправляем, потому что нас интересует не состояние в момент отправки,
|
|
21
|
+
* а что происходило за интервал: пик участников и все фичи, которые успели поработать.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ClientResourceStats {
|
|
24
|
+
private readonly _sources;
|
|
25
|
+
private readonly _debug;
|
|
26
|
+
private _timer;
|
|
27
|
+
private _participantsMax;
|
|
28
|
+
private _areaMpxMax;
|
|
29
|
+
private _features;
|
|
30
|
+
constructor(sources: ClientResourceSources, debug?: DebugLogger);
|
|
31
|
+
/** Забрать накопленное за интервал и начать копить заново */
|
|
32
|
+
takeReport(): ClientResourceReport;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
private _sample;
|
|
35
|
+
/**
|
|
36
|
+
* Площадь окна в физических пикселях: CSS-пиксели умножаем на devicePixelRatio,
|
|
37
|
+
* иначе одно и то же окно на экране с ретиной и без давало бы одинаковую цифру.
|
|
38
|
+
* Приложение в вебе — это одна вкладка, суммировать нечего.
|
|
39
|
+
*/
|
|
40
|
+
private _measureAreaMpx;
|
|
41
|
+
}
|
|
@@ -4,7 +4,9 @@ import TransportTopology from '../../enums/TransportTopology';
|
|
|
4
4
|
import HangupReason from '../HangupReason';
|
|
5
5
|
import StatEventCollector from './StatEventCollector';
|
|
6
6
|
import { ApiCallStats } from './ApiCallStats';
|
|
7
|
+
import { BatteryStats } from './BatteryStats';
|
|
7
8
|
import { CallLifecycleStats } from './CallLifecycleStats';
|
|
9
|
+
import { ClientResourceSources, ClientResourceStats } from './ClientResourceStats';
|
|
8
10
|
import { CodecStatsAggregator } from './CodecStatsAggregator';
|
|
9
11
|
import { StatAggregator } from './StatAggregator';
|
|
10
12
|
import { StatPings } from './StatPings';
|
|
@@ -17,9 +19,11 @@ export declare class ConversationStats {
|
|
|
17
19
|
readonly pings: StatPings;
|
|
18
20
|
readonly signalingCommands: StatSignalingCommands;
|
|
19
21
|
readonly apiCalls: ApiCallStats;
|
|
22
|
+
readonly resources: ClientResourceStats;
|
|
23
|
+
readonly battery: BatteryStats;
|
|
20
24
|
private readonly _api;
|
|
21
25
|
private _unloading;
|
|
22
|
-
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined);
|
|
26
|
+
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined, resourceSources: ClientResourceSources);
|
|
23
27
|
/**
|
|
24
28
|
* Вызывается из pagehide-обработчика: события финиша должны пережить смерть
|
|
25
29
|
* вкладки. Сводки пингов и команд сбрасываем здесь же — destroy() их только
|
|
@@ -32,8 +32,9 @@ export declare class SdpStats {
|
|
|
32
32
|
/** Не смогли применить SDP собеседника */
|
|
33
33
|
logSetRemoteFailed(sdp: SdpDescription, error: unknown): void;
|
|
34
34
|
destroy(): void;
|
|
35
|
-
private _intervalSince;
|
|
36
35
|
private _logFailure;
|
|
37
36
|
private _log;
|
|
38
37
|
}
|
|
38
|
+
/** Браузер может спрятать локальный адрес за именем вида <uuid>.local, такой кандидат в стату не шлём */
|
|
39
|
+
export declare function isIpAddress(address: string): boolean;
|
|
39
40
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ICallStatLog } from '../../types/PerfStatReporter';
|
|
2
2
|
import { IEventualStatLog } from '../../types/IEventualStatLog';
|
|
3
3
|
import StatEventCollector from './StatEventCollector';
|
|
4
|
+
import { ClientResourceStats } from './ClientResourceStats';
|
|
4
5
|
export declare class StatAggregator {
|
|
5
6
|
private readonly _logger;
|
|
7
|
+
private readonly _resources;
|
|
6
8
|
private readonly _eventualLogs;
|
|
7
9
|
private _lastCallStatContext;
|
|
8
|
-
constructor(logger: StatEventCollector);
|
|
10
|
+
constructor(logger: StatEventCollector, resources?: ClientResourceStats | null);
|
|
9
11
|
logCallStat(params: ICallStatLog): void;
|
|
10
12
|
/**
|
|
11
13
|
* Событие уходит с теми полями, что переданы. Без value — уходит без value.
|
|
@@ -2,7 +2,7 @@ import BaseApi from '../../abstract/BaseApi';
|
|
|
2
2
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../../enums/StatLog';
|
|
4
4
|
import TransportTopology from '../../enums/TransportTopology';
|
|
5
|
-
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
5
|
+
type ClientStatsPayload = Record<string, string | string[] | number | boolean | undefined | null>;
|
|
6
6
|
export type LogClientStatsOptions = {
|
|
7
7
|
/** Время наступления события. По умолчанию — момент записи. */
|
|
8
8
|
occurredAt?: number;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
export declare const RECORD_LIMIT = 5000;
|
|
3
3
|
/** Срок жизни события в очереди. */
|
|
4
4
|
export declare const MAX_AGE_MS: number;
|
|
5
|
-
/** Произвольный набор
|
|
6
|
-
export type StatPayload = Record<string, string | number | boolean | null>;
|
|
5
|
+
/** Произвольный набор полей события: скаляры и списки строк. */
|
|
6
|
+
export type StatPayload = Record<string, string | string[] | number | boolean | null>;
|
|
7
7
|
/** Запись очереди без сгенерированного ключа. */
|
|
8
8
|
export type StatQueueEntry = {
|
|
9
9
|
/** userId владельца события. Не может быть неизвестным. */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Signaling from '../../default/Signaling';
|
|
2
2
|
import TransportState from '../../enums/TransportState';
|
|
3
3
|
import EventEmitter from '../EventEmitter';
|
|
4
4
|
import { MediaSource } from '../MediaSource';
|
|
5
5
|
export default abstract class BaseTransport extends EventEmitter {
|
|
6
|
-
protected readonly _signaling:
|
|
6
|
+
protected readonly _signaling: Signaling;
|
|
7
7
|
protected readonly _mediaSource: MediaSource;
|
|
8
8
|
protected _state: TransportState;
|
|
9
9
|
protected _pc: RTCPeerConnection | null;
|
|
10
10
|
private readonly _onFirstMediaSent;
|
|
11
11
|
private _firstMediaSentProbe;
|
|
12
12
|
private _firstMediaSentProbeStopped;
|
|
13
|
-
protected constructor(signaling:
|
|
13
|
+
protected constructor(signaling: Signaling, mediaSource: MediaSource, onFirstMediaSent?: (() => void) | null);
|
|
14
14
|
getState(): TransportState;
|
|
15
15
|
stopFirstMediaSentProbe(): void;
|
|
16
16
|
abstract close(error?: Error): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Signaling from '../../default/Signaling';
|
|
2
2
|
import { type DebugLogger } from '../../static/Debug';
|
|
3
3
|
import { StatResult } from '../../types/Statistics';
|
|
4
4
|
import EventEmitter from '../EventEmitter';
|
|
@@ -32,7 +32,7 @@ export default class DirectStatReporter extends EventEmitter {
|
|
|
32
32
|
private _lastStatSentTimestamp;
|
|
33
33
|
private _currentState;
|
|
34
34
|
private readonly _debug;
|
|
35
|
-
constructor(signaling:
|
|
35
|
+
constructor(signaling: Signaling, debug?: DebugLogger);
|
|
36
36
|
private _calcRttRating;
|
|
37
37
|
private _calcLossRating;
|
|
38
38
|
private _calcBitrateRating;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnimojiReceiver, AnimojiSender } from '@vkontakte/calls-vmoji';
|
|
2
|
-
import
|
|
2
|
+
import type Signaling from '../../default/Signaling';
|
|
3
3
|
import { type DebugLogger } from '../../static/Debug';
|
|
4
4
|
import { ParticipantId } from '../../types/Participant';
|
|
5
5
|
import ServerSettings from '../../types/ServerSettings';
|
|
@@ -50,7 +50,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
50
50
|
private readonly _logger;
|
|
51
51
|
private readonly _statAggregator;
|
|
52
52
|
private readonly _codecStatsAggregator;
|
|
53
|
-
constructor(participantId: ParticipantId, isMaster: boolean, signaling:
|
|
53
|
+
constructor(participantId: ParticipantId, isMaster: boolean, signaling: Signaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
54
54
|
get participantId(): ParticipantId;
|
|
55
55
|
updateStatisticsInterval(): void;
|
|
56
56
|
private _isDeadConnection;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Signaling from '../../default/Signaling';
|
|
2
2
|
import { type DebugLogger } from '../../static/Debug';
|
|
3
3
|
import EventEmitter from '../EventEmitter';
|
|
4
4
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
@@ -8,15 +8,17 @@ export default class PerfStatReporter extends EventEmitter {
|
|
|
8
8
|
private _previousPerfStatReportTimestamp;
|
|
9
9
|
private _previousNetworkStatReportTimestamp;
|
|
10
10
|
private _previousCallStatReportTimestamp;
|
|
11
|
-
private
|
|
11
|
+
private _previousCounters;
|
|
12
12
|
private _previousRemoteInboundRtps;
|
|
13
|
+
private _previousInboundRtps;
|
|
14
|
+
private _previousOutboundRtps;
|
|
13
15
|
private _previousCandidatePair;
|
|
14
16
|
private _screenShareStats;
|
|
15
17
|
private _signaling;
|
|
16
18
|
private readonly _directTopology;
|
|
17
19
|
private readonly _debug;
|
|
18
20
|
private readonly _statAggregator;
|
|
19
|
-
constructor(transport: ServerTransport | DirectTransport, signaling:
|
|
21
|
+
constructor(transport: ServerTransport | DirectTransport, signaling: Signaling, statAggregator?: StatAggregator | null, directTopology?: boolean, debug?: DebugLogger);
|
|
20
22
|
destroy(): void;
|
|
21
23
|
static getEstimatedPerformanceIndex(): number;
|
|
22
24
|
private _handleStats;
|
|
@@ -24,7 +26,9 @@ export default class PerfStatReporter extends EventEmitter {
|
|
|
24
26
|
private reportNetworkStats;
|
|
25
27
|
private _reportCallStats;
|
|
26
28
|
private _reportCandidatePair;
|
|
29
|
+
private _calculateRemotePacketLoss;
|
|
27
30
|
private _calculatePacketLoss;
|
|
31
|
+
private _calculateOutboundDeltas;
|
|
28
32
|
private _handleScreenSharingStat;
|
|
29
33
|
private _handleTransportStateChanged;
|
|
30
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnimojiReceiver, AnimojiSender } from '@vkontakte/calls-vmoji';
|
|
2
|
-
import
|
|
2
|
+
import type Signaling from '../../default/Signaling';
|
|
3
3
|
import { type DebugLogger } from '../../static/Debug';
|
|
4
4
|
import { ParticipantId } from '../../types/Participant';
|
|
5
5
|
import ServerSettings from '../../types/ServerSettings';
|
|
@@ -49,7 +49,7 @@ export default class ServerTransport extends BaseTransport {
|
|
|
49
49
|
private readonly _peerConnectionStats;
|
|
50
50
|
private readonly _codecStatsAggregator;
|
|
51
51
|
private readonly _simulcast;
|
|
52
|
-
constructor(signaling:
|
|
52
|
+
constructor(signaling: Signaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
53
53
|
updateStatisticsInterval(): void;
|
|
54
54
|
open(observer?: boolean): void;
|
|
55
55
|
close(error?: Error): void;
|
|
@@ -83,6 +83,8 @@ export default class ServerTransport extends BaseTransport {
|
|
|
83
83
|
private _startSettingsInterval;
|
|
84
84
|
private _stopSettingsInterval;
|
|
85
85
|
private _collectStat;
|
|
86
|
+
/** mid потока быстрой шары, чтобы отделить его от камеры в статистике */
|
|
87
|
+
private _getScreenShareMid;
|
|
86
88
|
private _reportStats;
|
|
87
89
|
private _detectStaleTracks;
|
|
88
90
|
private _allocateConsumer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Signaling from '../../default/Signaling';
|
|
2
2
|
import { type DebugLogger } from '../../static/Debug';
|
|
3
3
|
import type VideoSettings from '../../types/VideoSettings';
|
|
4
4
|
import { MediaSource } from '../MediaSource';
|
|
@@ -12,7 +12,7 @@ export default class SimulcastSender {
|
|
|
12
12
|
private readonly _getCameraSettings;
|
|
13
13
|
private readonly _debug;
|
|
14
14
|
private readonly _logger;
|
|
15
|
-
constructor(signaling:
|
|
15
|
+
constructor(signaling: Signaling, mediaSource: MediaSource, getCameraSettings: () => VideoSettings | null, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
16
16
|
configureFromRemoteOffer(pc: RTCPeerConnection): Promise<void>;
|
|
17
17
|
finalizeAnswer(sdp: string): string;
|
|
18
18
|
sync({ force }?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnimojiSvgData, RGBTuple } from '@vkontakte/calls-vmoji';
|
|
2
|
-
import
|
|
2
|
+
import type Signaling from '../../default/Signaling';
|
|
3
3
|
import TransportState from '../../enums/TransportState';
|
|
4
4
|
import TransportTopology from '../../enums/TransportTopology';
|
|
5
5
|
import { type DebugLogger } from '../../static/Debug';
|
|
@@ -51,7 +51,7 @@ export declare class Transport extends EventEmitter {
|
|
|
51
51
|
private readonly _onFirstMediaSent;
|
|
52
52
|
private _firstMediaSentProbeStopped;
|
|
53
53
|
private _vadController;
|
|
54
|
-
constructor(topology: TransportTopology, signaling:
|
|
54
|
+
constructor(topology: TransportTopology, signaling: Signaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
55
55
|
updateSettings(settings: ServerSettings): void;
|
|
56
56
|
updateStatisticsInterval(): void;
|
|
57
57
|
allocate(participantId: ParticipantId, isMaster?: boolean): void;
|
package/default/Api.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import PushData from '../types/PushData';
|
|
|
10
10
|
export default class Api extends BaseApi {
|
|
11
11
|
private _uuid;
|
|
12
12
|
private _idCache;
|
|
13
|
+
constructor();
|
|
13
14
|
private _callUnsafe;
|
|
14
15
|
protected _call(method: string, data?: any, noSession?: boolean, allowReauthorize?: boolean): Promise<any>;
|
|
15
16
|
userId(participantId: ParticipantId): ExternalParticipantId | null;
|
|
@@ -22,6 +23,8 @@ export default class Api extends BaseApi {
|
|
|
22
23
|
private _removeCachedAnonymLogin;
|
|
23
24
|
private _reauthorize;
|
|
24
25
|
private _applyAnonymLogin;
|
|
26
|
+
/** Кладёт в кеш id соответствие своего участника из auth.anonymLogin */
|
|
27
|
+
private _cacheSelfExternalId;
|
|
25
28
|
private _buildClientStatsData;
|
|
26
29
|
/** Ошибки по отдельным событиям логируются, но батч трактуется целиком. */
|
|
27
30
|
private _reportClientStatsItemErrors;
|
package/default/Signaling.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import EventEmitter from '../classes/EventEmitter';
|
|
2
|
+
import type { AddParticipantParams } from '../types/AddParticipantParams';
|
|
2
3
|
import { ParticipantIdRegistry } from '../classes/ParticipantIdRegistry';
|
|
3
4
|
import { SharingStatReport } from '../classes/screenshare/SharingStatReport';
|
|
4
5
|
import { StatAggregator } from '../classes/stat/StatAggregator';
|
|
@@ -15,6 +16,7 @@ import { type DebugLogger } from '../static/Debug';
|
|
|
15
16
|
import { JSONObject } from '../static/Json';
|
|
16
17
|
import { IAsrStartParams, IAsrStopParams } from '../types/Asr';
|
|
17
18
|
import { ChangeSimulcast } from '../types/ChangeSimulcast';
|
|
19
|
+
import ConversationResponse from '../types/ConversationResponse';
|
|
18
20
|
import MediaModifiers from '../types/MediaModifiers';
|
|
19
21
|
import MediaSettings from '../types/MediaSettings';
|
|
20
22
|
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
@@ -27,10 +29,9 @@ import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
|
|
|
27
29
|
import { PerfStatReport } from '../types/PerfStatReporter';
|
|
28
30
|
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
|
|
29
31
|
import { IPublishStreamData, IStartStreamData, IStopStreamData } from '../types/Streams';
|
|
30
|
-
export default class Signaling extends
|
|
31
|
-
private
|
|
32
|
+
export default class Signaling extends EventEmitter {
|
|
33
|
+
private session;
|
|
32
34
|
private sequence;
|
|
33
|
-
private lastStamp;
|
|
34
35
|
private websocketCommandsQueue;
|
|
35
36
|
private datachannelCommandsQueue;
|
|
36
37
|
private incomingCache;
|
|
@@ -39,12 +40,9 @@ export default class Signaling extends BaseSignaling {
|
|
|
39
40
|
private connectionType;
|
|
40
41
|
private conversationResolve;
|
|
41
42
|
private conversationReject;
|
|
42
|
-
private connected;
|
|
43
43
|
private listenersReady;
|
|
44
|
-
private peerId;
|
|
45
44
|
/** Когда началась череда падений соединения, от неё считаем *_timeout */
|
|
46
45
|
private reconnectStartedAt;
|
|
47
|
-
private connectionMessageWaitTimer;
|
|
48
46
|
private participantIdRegistry;
|
|
49
47
|
private producerNotificationDataChannel;
|
|
50
48
|
private producerCommandDataChannel;
|
|
@@ -55,13 +53,10 @@ export default class Signaling extends BaseSignaling {
|
|
|
55
53
|
private readonly _statAggregator;
|
|
56
54
|
private readonly _statPings;
|
|
57
55
|
private readonly _statSignalingCommands;
|
|
58
|
-
private static get WAIT_CONNECTION_DELAY();
|
|
59
56
|
private static get WAIT_RESPONSE_DELAY();
|
|
60
57
|
get ready(): boolean;
|
|
61
58
|
constructor(debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, statPings?: StatPings | null, statSignalingCommands?: StatSignalingCommands | null);
|
|
62
59
|
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
63
|
-
setEndpoint(endpoint: string): void;
|
|
64
|
-
setWebTransportEndpoint(endpoint: string | null): void;
|
|
65
60
|
setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
|
|
66
61
|
setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
|
|
67
62
|
setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
|
|
@@ -70,7 +65,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
70
65
|
/**
|
|
71
66
|
* Open a connection with a signaling server
|
|
72
67
|
*/
|
|
73
|
-
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
68
|
+
connect(connectionType: SignalingConnectionType, conversation: ConversationResponse): Promise<SignalingMessage.Connection>;
|
|
74
69
|
getNextCommandSequenceNumber(): number;
|
|
75
70
|
hangup(reason: string): Promise<SignalingMessage>;
|
|
76
71
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
@@ -180,14 +175,12 @@ export default class Signaling extends BaseSignaling {
|
|
|
180
175
|
private _serializeBinary;
|
|
181
176
|
private _serializeJson;
|
|
182
177
|
private _convertDisplayLayout;
|
|
183
|
-
private _waitConnectionMessage;
|
|
184
|
-
private _stopWaitConnectionMessage;
|
|
185
178
|
private _onTransportConnecting;
|
|
186
|
-
private
|
|
187
|
-
private
|
|
179
|
+
private _onSessionFailed;
|
|
180
|
+
private _onSessionReconnectScheduled;
|
|
188
181
|
/** Попыток восстановить соединение больше не будет: отправляем, сколько длилась череда падений */
|
|
189
182
|
private _logReconnectTimeout;
|
|
190
|
-
private
|
|
183
|
+
private _onSessionInactive;
|
|
191
184
|
private _attachNotificationCallError;
|
|
192
185
|
private _createSignalingCallError;
|
|
193
186
|
private _getSocketType;
|