@vkontakte/calls-sdk 2.8.13-dev.f163e503.0 → 2.8.13-dev.f7edd589.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 +42 -16
- package/abstract/BaseApi.d.ts +13 -9
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +5062 -3531
- package/classes/AudioFix.d.ts +2 -2
- package/classes/AudioOutput.d.ts +7 -6
- package/classes/CallRegistry.d.ts +22 -6
- package/classes/MediaSource.d.ts +16 -2
- package/classes/SignalingErrors.d.ts +6 -0
- package/classes/SpecListener.d.ts +2 -2
- package/classes/StatsLogger.d.ts +1 -1
- package/classes/VolumesDetector.d.ts +0 -1
- package/classes/codec/LibVPxDecoder.d.ts +2 -2
- package/classes/codec/LibVPxEncoder.d.ts +2 -2
- package/classes/codec/WebCodecsDecoder.d.ts +2 -2
- package/classes/codec/WebCodecsEncoder.d.ts +2 -2
- package/classes/codec/WorkerBase.d.ts +3 -3
- package/classes/conversation/Conversation.d.ts +29 -10
- package/classes/conversation/Conversation.testUtils.d.ts +4 -3
- package/classes/screenshare/ScreenCaptureReceiver.d.ts +2 -2
- package/classes/screenshare/ScreenCaptureSender.d.ts +3 -3
- package/classes/screenshare/StreamBuilder.d.ts +2 -2
- package/classes/stat/ApiCallStats.d.ts +12 -0
- package/classes/stat/BatteryStats.d.ts +25 -0
- package/classes/stat/CallLifecycleStats.d.ts +5 -2
- package/classes/stat/CallStatTail.d.ts +65 -0
- package/classes/stat/ClientResourceStats.d.ts +41 -0
- package/classes/stat/CodecStatsAggregator.d.ts +5 -2
- package/classes/stat/ConversationStats.d.ts +20 -3
- package/classes/stat/NetworkAdaptationStats.d.ts +35 -0
- package/classes/stat/PeerConnectionStats.d.ts +22 -0
- package/classes/stat/SdpStats.d.ts +2 -0
- package/classes/stat/Stat.testUtils.d.ts +17 -0
- package/classes/stat/StatAggregator.d.ts +12 -3
- package/classes/stat/StatClock.d.ts +28 -0
- package/classes/stat/StatDrainScheduler.d.ts +113 -0
- package/classes/stat/StatEventCollector.d.ts +45 -0
- package/classes/stat/StatPings.d.ts +6 -2
- package/classes/stat/StatQueue.d.ts +118 -0
- package/classes/stat/StatSignalingCommands.d.ts +4 -2
- package/classes/transport/BaseTransport.d.ts +3 -3
- package/classes/transport/DirectNetworkRating.d.ts +16 -0
- package/classes/transport/DirectTransport.d.ts +17 -4
- package/classes/transport/PerfStatReporter.d.ts +10 -4
- package/classes/transport/RemotePacketLoss.d.ts +15 -0
- package/classes/transport/ServerTransport.d.ts +6 -3
- package/classes/transport/SimulcastSender.d.ts +3 -3
- package/classes/transport/Statistics.d.ts +5 -4
- package/classes/transport/Transport.d.ts +6 -6
- package/default/Api.d.ts +13 -1
- package/default/Signaling.d.ts +22 -20
- package/default/SignalingSession.d.ts +92 -0
- package/enums/ActiveFeature.d.ts +19 -0
- package/enums/SessionError.d.ts +10 -0
- package/enums/Stat.d.ts +14 -1
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +4 -0
- package/static/AuthData.d.ts +11 -1
- package/static/BrowserEnvironment.d.ts +90 -0
- package/static/External.d.ts +11 -0
- package/static/Params.d.ts +88 -18
- package/static/SessionStore.d.ts +29 -0
- package/static/SimulcastInfo.d.ts +1 -0
- package/static/WebRTCUtils.d.ts +5 -76
- package/types/AddParticipantParams.d.ts +18 -0
- package/types/ClientStatsEvent.d.ts +12 -0
- package/types/ExternalId.d.ts +1 -1
- package/types/FastHangup.d.ts +7 -5
- package/types/IEventualStatLog.d.ts +1 -1
- package/types/Params.d.ts +1 -1
- package/types/Participant.d.ts +2 -2
- package/types/PerfStatReporter.d.ts +26 -1
- package/types/SignalingMessage.d.ts +3 -0
- package/types/Statistics.d.ts +22 -7
- package/abstract/BaseSignaling.d.ts +0 -143
- package/classes/transport/DirectStatReporter.d.ts +0 -46
- package/default/SignalingTransport.d.ts +0 -76
|
@@ -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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StatResult } from '../../types/Statistics';
|
|
2
|
+
export interface NetworkLimits {
|
|
3
|
+
goodNet?: {
|
|
4
|
+
rtt?: number;
|
|
5
|
+
loss?: number;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export default class DirectNetworkRating {
|
|
9
|
+
private readonly _rtt;
|
|
10
|
+
private readonly _incomingLoss;
|
|
11
|
+
private readonly _outgoingLoss;
|
|
12
|
+
private readonly _remotePacketLoss;
|
|
13
|
+
private readonly _goodNet;
|
|
14
|
+
updateSettings(settings?: NetworkLimits): void;
|
|
15
|
+
update(stats: StatResult): number;
|
|
16
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
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';
|
|
6
|
-
import
|
|
6
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
7
7
|
import { MediaSource } from '../MediaSource';
|
|
8
8
|
import { CodecStatsAggregator } from '../stat/CodecStatsAggregator';
|
|
9
9
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
@@ -21,6 +21,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
21
21
|
private _isOpen;
|
|
22
22
|
private _remotePeerId;
|
|
23
23
|
private _statInterval;
|
|
24
|
+
private _mediaCheckInterval;
|
|
24
25
|
private _settingsInterval;
|
|
25
26
|
private _failedOnCreate;
|
|
26
27
|
private _remoteStream;
|
|
@@ -31,6 +32,10 @@ export default class DirectTransport extends BaseTransport {
|
|
|
31
32
|
private _lastStat;
|
|
32
33
|
private _fingerprint;
|
|
33
34
|
private _neverConnected;
|
|
35
|
+
private _connectionStartedAt;
|
|
36
|
+
private _connectionLostAt;
|
|
37
|
+
/** Запросили переход на серверную топологию, не дождавшись первого подключения p2p */
|
|
38
|
+
private _serverRequestedOnNoConnection;
|
|
34
39
|
private _serverSettings;
|
|
35
40
|
private _prevConsumerSettings;
|
|
36
41
|
private _networkLimitsForVideo;
|
|
@@ -38,13 +43,15 @@ export default class DirectTransport extends BaseTransport {
|
|
|
38
43
|
private _lastVideoMaxDimension;
|
|
39
44
|
private _lastBadConnection;
|
|
40
45
|
private _perfStatReporter;
|
|
41
|
-
private
|
|
46
|
+
private readonly _directNetworkRating;
|
|
42
47
|
private readonly _sdpStats;
|
|
48
|
+
private readonly _peerConnectionStats;
|
|
49
|
+
private readonly _networkAdaptationStats;
|
|
43
50
|
private readonly _debug;
|
|
44
51
|
private readonly _logger;
|
|
45
52
|
private readonly _statAggregator;
|
|
46
53
|
private readonly _codecStatsAggregator;
|
|
47
|
-
constructor(participantId: ParticipantId, isMaster: boolean, signaling:
|
|
54
|
+
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);
|
|
48
55
|
get participantId(): ParticipantId;
|
|
49
56
|
updateStatisticsInterval(): void;
|
|
50
57
|
private _isDeadConnection;
|
|
@@ -72,7 +79,13 @@ export default class DirectTransport extends BaseTransport {
|
|
|
72
79
|
private _onIceConnectionStateChange;
|
|
73
80
|
private _markConnected;
|
|
74
81
|
private _onConnectionStateChange;
|
|
82
|
+
private _startCheckingMedia;
|
|
83
|
+
private _stopCheckingMedia;
|
|
75
84
|
private _startReconnection;
|
|
85
|
+
/**
|
|
86
|
+
* Запрашивает у сигналинга переход на серверную топологию.
|
|
87
|
+
* Обычно это делает только мастер, `fromAnySide` снимает это ограничение.
|
|
88
|
+
*/
|
|
76
89
|
private _requestTopologySwitch;
|
|
77
90
|
private _stopReconnection;
|
|
78
91
|
private _startIceRestart;
|
|
@@ -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,21 +8,27 @@ export default class PerfStatReporter extends EventEmitter {
|
|
|
8
8
|
private _previousPerfStatReportTimestamp;
|
|
9
9
|
private _previousNetworkStatReportTimestamp;
|
|
10
10
|
private _previousCallStatReportTimestamp;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
11
|
+
private _previousCounters;
|
|
12
|
+
private readonly _remotePacketLoss;
|
|
13
|
+
private _previousInboundRtps;
|
|
14
|
+
private _previousOutboundRtps;
|
|
15
|
+
private _previousCandidatePair;
|
|
13
16
|
private _screenShareStats;
|
|
14
17
|
private _signaling;
|
|
15
18
|
private readonly _directTopology;
|
|
16
19
|
private readonly _debug;
|
|
17
20
|
private readonly _statAggregator;
|
|
18
|
-
constructor(transport: ServerTransport | DirectTransport, signaling:
|
|
21
|
+
constructor(transport: ServerTransport | DirectTransport, signaling: Signaling, statAggregator?: StatAggregator | null, directTopology?: boolean, debug?: DebugLogger);
|
|
19
22
|
destroy(): void;
|
|
20
23
|
static getEstimatedPerformanceIndex(): number;
|
|
21
24
|
private _handleStats;
|
|
22
25
|
private reportPerfStats;
|
|
23
26
|
private reportNetworkStats;
|
|
24
27
|
private _reportCallStats;
|
|
28
|
+
private _reportCandidatePair;
|
|
29
|
+
private _calculateRemotePacketLoss;
|
|
25
30
|
private _calculatePacketLoss;
|
|
31
|
+
private _calculateOutboundDeltas;
|
|
26
32
|
private _handleScreenSharingStat;
|
|
27
33
|
private _handleTransportStateChanged;
|
|
28
34
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StatRtp } from '../../types/Statistics';
|
|
2
|
+
export declare class RemotePacketLoss {
|
|
3
|
+
private _previous;
|
|
4
|
+
clear(): void;
|
|
5
|
+
update(rtps: StatRtp[], outboundRtps: StatRtp[]): {
|
|
6
|
+
audio: {
|
|
7
|
+
lost: number;
|
|
8
|
+
sent: number;
|
|
9
|
+
};
|
|
10
|
+
video: {
|
|
11
|
+
lost: number;
|
|
12
|
+
sent: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
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';
|
|
6
|
-
import
|
|
6
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
7
7
|
import { MediaSource } from '../MediaSource';
|
|
8
8
|
import { CodecStatsAggregator } from '../stat/CodecStatsAggregator';
|
|
9
9
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
@@ -46,9 +46,10 @@ export default class ServerTransport extends BaseTransport {
|
|
|
46
46
|
private readonly _logger;
|
|
47
47
|
private readonly _statAggregator;
|
|
48
48
|
private readonly _sdpStats;
|
|
49
|
+
private readonly _peerConnectionStats;
|
|
49
50
|
private readonly _codecStatsAggregator;
|
|
50
51
|
private readonly _simulcast;
|
|
51
|
-
constructor(signaling:
|
|
52
|
+
constructor(signaling: Signaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
52
53
|
updateStatisticsInterval(): void;
|
|
53
54
|
open(observer?: boolean): void;
|
|
54
55
|
close(error?: Error): void;
|
|
@@ -82,6 +83,8 @@ export default class ServerTransport extends BaseTransport {
|
|
|
82
83
|
private _startSettingsInterval;
|
|
83
84
|
private _stopSettingsInterval;
|
|
84
85
|
private _collectStat;
|
|
86
|
+
/** mid потока быстрой шары, чтобы отделить его от камеры в статистике */
|
|
87
|
+
private _getScreenShareMid;
|
|
85
88
|
private _reportStats;
|
|
86
89
|
private _detectStaleTracks;
|
|
87
90
|
private _allocateConsumer;
|
|
@@ -1,8 +1,8 @@
|
|
|
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';
|
|
5
|
-
import
|
|
5
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
6
6
|
export default class SimulcastSender {
|
|
7
7
|
private _pc;
|
|
8
8
|
private _transceiver;
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
1
2
|
import { ParticipantId } from '../../types/Participant';
|
|
2
3
|
import { StatItem, StatRtp, StatTransport } from '../../types/Statistics';
|
|
3
4
|
export declare const NO_STAT_REQUEST_DELAY = 1000;
|
|
@@ -7,18 +8,18 @@ declare function rtcStatsToArray(stats: RTCStatsReport[]): RTCStats[];
|
|
|
7
8
|
* Extracts transport statistics from the gives stats
|
|
8
9
|
* @hidden
|
|
9
10
|
*/
|
|
10
|
-
declare function extractTransport(stats: RTCStats[]): StatTransport;
|
|
11
|
+
declare function extractTransport(stats: RTCStats[], topology: TransportTopology): StatTransport;
|
|
11
12
|
/**
|
|
12
13
|
* Extracts media statistics from the given stats
|
|
13
14
|
* @hidden
|
|
14
15
|
*/
|
|
15
|
-
declare function extractRtps(stats: RTCStats[], ssrcMap: Record<string, string
|
|
16
|
+
declare function extractRtps(stats: RTCStats[], ssrcMap: Partial<Record<string, string>>, needToExtractRemote?: boolean): StatRtp[];
|
|
16
17
|
/**
|
|
17
18
|
* Computes delta (the difference) between two stat reports.
|
|
18
19
|
* @hidden
|
|
19
20
|
*/
|
|
20
|
-
declare function delta(current: StatItem, previous: StatItem
|
|
21
|
-
declare function collectStats(pc: RTCPeerConnection, previous: StatItem | null, ssrcMap?: Record<string, string
|
|
21
|
+
declare function delta(current: StatItem, previous: StatItem): StatItem;
|
|
22
|
+
declare function collectStats(pc: RTCPeerConnection, previous: StatItem | null, topology: TransportTopology, ssrcMap?: Partial<Record<string, string>>): Promise<StatItem>;
|
|
22
23
|
declare function setMark(name: string): void;
|
|
23
24
|
declare function clearMark(name: string): void;
|
|
24
25
|
declare function measureMark(name: string): null | number;
|
|
@@ -1,12 +1,12 @@
|
|
|
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';
|
|
6
6
|
import { ParticipantId } from '../../types/Participant';
|
|
7
7
|
import ServerSettings from '../../types/ServerSettings';
|
|
8
8
|
import EventEmitter from '../EventEmitter';
|
|
9
|
-
import
|
|
9
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
10
10
|
import { MediaSource } from '../MediaSource';
|
|
11
11
|
import { CodecStatsAggregator } from '../stat/CodecStatsAggregator';
|
|
12
12
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
@@ -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;
|
|
@@ -63,10 +63,10 @@ export declare class Transport extends EventEmitter {
|
|
|
63
63
|
setRemoteHold(hold: boolean): void;
|
|
64
64
|
getTopology(): TransportTopology;
|
|
65
65
|
isAllocated(participantId: ParticipantId): boolean;
|
|
66
|
-
allocated():
|
|
67
|
-
opened():
|
|
66
|
+
allocated(): ParticipantId[];
|
|
67
|
+
opened(): ParticipantId[];
|
|
68
68
|
getState(): TransportState | undefined;
|
|
69
|
-
getStates(): Record<
|
|
69
|
+
getStates(): Record<ParticipantId, TransportState>;
|
|
70
70
|
setAnimojiSvg(participantId: ParticipantId, svgData: AnimojiSvgData): void;
|
|
71
71
|
setAnimojiFill(fill: RGBTuple | string): void;
|
|
72
72
|
onCameraResolutionChanged(): Promise<void>;
|
package/default/Api.d.ts
CHANGED
|
@@ -10,18 +10,30 @@ 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;
|
|
16
17
|
authorize(): Promise<void>;
|
|
18
|
+
/** Запрос auth.anonymLogin без побочных эффектов. Пустой токен — версия 2. */
|
|
19
|
+
private _anonymLogin;
|
|
17
20
|
private _getAnonymLoginCacheKey;
|
|
18
21
|
private _getCachedAnonymLogin;
|
|
19
22
|
private _setCachedAnonymLogin;
|
|
20
23
|
private _removeCachedAnonymLogin;
|
|
21
24
|
private _reauthorize;
|
|
22
25
|
private _applyAnonymLogin;
|
|
26
|
+
/** Кладёт в кеш id соответствие своего участника из auth.anonymLogin */
|
|
27
|
+
private _cacheSelfExternalId;
|
|
28
|
+
private _buildClientStatsData;
|
|
29
|
+
/** Ошибки по отдельным событиям логируются, но батч трактуется целиком. */
|
|
30
|
+
private _reportClientStatsItemErrors;
|
|
31
|
+
/** noSession = true, иначе _prepareQuery перебил бы явный session_key. */
|
|
32
|
+
private _sendClientStatsWith;
|
|
33
|
+
/** Бекенд отвечает 200 всегда: ошибки статистики лежат в теле. */
|
|
23
34
|
private _sendClientStats;
|
|
24
|
-
logClientStats(items: ClientStats[]): void
|
|
35
|
+
logClientStats(items: ClientStats[]): Promise<void>;
|
|
36
|
+
logClientStatsWith(sessionKey: string, items: ClientStats[]): Promise<void>;
|
|
25
37
|
uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
|
|
26
38
|
joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
|
|
27
39
|
createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie, audienceMode, audioOnly, waitForAdmin, closedConversation, }?: {
|
package/default/Signaling.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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';
|
|
5
6
|
import { StatPings } from '../classes/stat/StatPings';
|
|
6
7
|
import { StatSignalingCommands } from '../classes/stat/StatSignalingCommands';
|
|
7
|
-
import
|
|
8
|
+
import StatEventCollector from '../classes/stat/StatEventCollector';
|
|
8
9
|
import ConversationFeature from '../enums/ConversationFeature';
|
|
9
10
|
import ConversationOption from '../enums/ConversationOption';
|
|
10
11
|
import MediaOption from '../enums/MediaOption';
|
|
@@ -15,6 +16,8 @@ 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';
|
|
20
|
+
import { ExternalUserId } from '../types/ExternalId';
|
|
18
21
|
import MediaModifiers from '../types/MediaModifiers';
|
|
19
22
|
import MediaSettings from '../types/MediaSettings';
|
|
20
23
|
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
@@ -27,10 +30,9 @@ import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
|
|
|
27
30
|
import { PerfStatReport } from '../types/PerfStatReporter';
|
|
28
31
|
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
|
|
29
32
|
import { IPublishStreamData, IStartStreamData, IStopStreamData } from '../types/Streams';
|
|
30
|
-
export default class Signaling extends
|
|
31
|
-
private
|
|
33
|
+
export default class Signaling extends EventEmitter {
|
|
34
|
+
private session;
|
|
32
35
|
private sequence;
|
|
33
|
-
private lastStamp;
|
|
34
36
|
private websocketCommandsQueue;
|
|
35
37
|
private datachannelCommandsQueue;
|
|
36
38
|
private incomingCache;
|
|
@@ -39,10 +41,9 @@ export default class Signaling extends BaseSignaling {
|
|
|
39
41
|
private connectionType;
|
|
40
42
|
private conversationResolve;
|
|
41
43
|
private conversationReject;
|
|
42
|
-
private connected;
|
|
43
44
|
private listenersReady;
|
|
44
|
-
|
|
45
|
-
private
|
|
45
|
+
/** Когда началась череда падений соединения, от неё считаем *_timeout */
|
|
46
|
+
private reconnectStartedAt;
|
|
46
47
|
private participantIdRegistry;
|
|
47
48
|
private producerNotificationDataChannel;
|
|
48
49
|
private producerCommandDataChannel;
|
|
@@ -53,13 +54,10 @@ export default class Signaling extends BaseSignaling {
|
|
|
53
54
|
private readonly _statAggregator;
|
|
54
55
|
private readonly _statPings;
|
|
55
56
|
private readonly _statSignalingCommands;
|
|
56
|
-
private static get WAIT_CONNECTION_DELAY();
|
|
57
57
|
private static get WAIT_RESPONSE_DELAY();
|
|
58
58
|
get ready(): boolean;
|
|
59
|
-
constructor(debug?: DebugLogger, logger?:
|
|
59
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, statPings?: StatPings | null, statSignalingCommands?: StatSignalingCommands | null);
|
|
60
60
|
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
61
|
-
setEndpoint(endpoint: string): void;
|
|
62
|
-
setWebTransportEndpoint(endpoint: string | null): void;
|
|
63
61
|
setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
|
|
64
62
|
setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
|
|
65
63
|
setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
|
|
@@ -68,7 +66,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
68
66
|
/**
|
|
69
67
|
* Open a connection with a signaling server
|
|
70
68
|
*/
|
|
71
|
-
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
69
|
+
connect(connectionType: SignalingConnectionType, conversation: ConversationResponse): Promise<SignalingMessage.Connection>;
|
|
72
70
|
getNextCommandSequenceNumber(): number;
|
|
73
71
|
hangup(reason: string): Promise<SignalingMessage>;
|
|
74
72
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
@@ -79,7 +77,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
79
77
|
changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<SignalingMessage>;
|
|
80
78
|
hold(hold: boolean): Promise<SignalingMessage>;
|
|
81
79
|
putHandsDown(): Promise<SignalingMessage>;
|
|
82
|
-
addParticipant(externalIds:
|
|
80
|
+
addParticipant(externalIds: ExternalUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
|
|
83
81
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
|
|
84
82
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<SignalingMessage>;
|
|
85
83
|
allocateConsumer(description: RTCSessionDescription | null, capabilities: {
|
|
@@ -164,7 +162,8 @@ export default class Signaling extends BaseSignaling {
|
|
|
164
162
|
private _handleCachedMessages;
|
|
165
163
|
private _throwError;
|
|
166
164
|
private _onError;
|
|
167
|
-
|
|
165
|
+
/** Причина ошибки для статы: короткий читаемый текст */
|
|
166
|
+
private _describeErrorEvent;
|
|
168
167
|
private _onClose;
|
|
169
168
|
private _terminate;
|
|
170
169
|
private _fail;
|
|
@@ -177,15 +176,18 @@ export default class Signaling extends BaseSignaling {
|
|
|
177
176
|
private _serializeBinary;
|
|
178
177
|
private _serializeJson;
|
|
179
178
|
private _convertDisplayLayout;
|
|
180
|
-
private _waitConnectionMessage;
|
|
181
|
-
private _stopWaitConnectionMessage;
|
|
182
179
|
private _onTransportConnecting;
|
|
183
|
-
private
|
|
184
|
-
private
|
|
185
|
-
|
|
180
|
+
private _onSessionFailed;
|
|
181
|
+
private _onSessionReconnectScheduled;
|
|
182
|
+
/** Попыток восстановить соединение больше не будет: отправляем, сколько длилась череда падений */
|
|
183
|
+
private _logReconnectTimeout;
|
|
184
|
+
private _onSessionInactive;
|
|
186
185
|
private _attachNotificationCallError;
|
|
187
186
|
private _createSignalingCallError;
|
|
188
187
|
private _getSocketType;
|
|
189
188
|
private _markTransportStat;
|
|
189
|
+
/** Событие уходит с переданными полями, без value — уходит без value */
|
|
190
190
|
private _logTransportStat;
|
|
191
|
+
/** value — время от метки, поставленной в _markTransportStat; метки нет — событие не отправляем */
|
|
192
|
+
private _logTransportStatSinceMark;
|
|
191
193
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
2
|
+
import { SignalingTransportType } from '../enums/SignalingTransportStat';
|
|
3
|
+
import { DebugLogger } from '../static/Debug';
|
|
4
|
+
import SignalingMessage from '../types/SignalingMessage';
|
|
5
|
+
export declare enum SignalingSessionFailure {
|
|
6
|
+
EMPTY_ENDPOINT = "EMPTY_ENDPOINT",
|
|
7
|
+
CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT",
|
|
8
|
+
RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT",
|
|
9
|
+
ABORTED = "ABORTED"
|
|
10
|
+
}
|
|
11
|
+
export type SignalingSessionFailedEvent = {
|
|
12
|
+
failure: SignalingSessionFailure;
|
|
13
|
+
message: string;
|
|
14
|
+
source: SignalingTransportType;
|
|
15
|
+
remote?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type SignalingSessionReconnectEvent = {
|
|
18
|
+
count: number;
|
|
19
|
+
delay: number;
|
|
20
|
+
};
|
|
21
|
+
export type SignalingSessionConnectingEvent = {
|
|
22
|
+
connectionType: SignalingConnectionType;
|
|
23
|
+
source: SignalingTransportType;
|
|
24
|
+
};
|
|
25
|
+
export type SignalingSessionHandlers = {
|
|
26
|
+
onConnecting: (event: SignalingSessionConnectingEvent) => void;
|
|
27
|
+
onOpen: () => void;
|
|
28
|
+
onMessage: (message: SignalingMessage | 'ping') => void;
|
|
29
|
+
onParseError: (error: unknown, data: unknown) => void;
|
|
30
|
+
onError: (event: Event) => void;
|
|
31
|
+
onClose: (event: CloseEvent) => void;
|
|
32
|
+
onFailed: (event: SignalingSessionFailedEvent) => void;
|
|
33
|
+
onReconnectScheduled: (event: SignalingSessionReconnectEvent) => void;
|
|
34
|
+
onInactive: () => void;
|
|
35
|
+
};
|
|
36
|
+
export default class SignalingSession {
|
|
37
|
+
private readonly _debug;
|
|
38
|
+
private readonly handlers;
|
|
39
|
+
private socket;
|
|
40
|
+
private state;
|
|
41
|
+
private endpoint;
|
|
42
|
+
private wtEndpoint;
|
|
43
|
+
private peerId;
|
|
44
|
+
private lastStamp;
|
|
45
|
+
private connectionType;
|
|
46
|
+
private reconnectCount;
|
|
47
|
+
/** Таймер задержки перед следующей попыткой подключения. */
|
|
48
|
+
private retryTimer;
|
|
49
|
+
/** Таймер ожидания нотификации connection при подключении или восстановлении; повторные попытки не продлевают общий срок. */
|
|
50
|
+
private connectionDeadlineTimer;
|
|
51
|
+
/** Таймер текущей попытки: сначала ждёт открытия сокета, затем перезапускается для ожидания нотификации connection. */
|
|
52
|
+
private attemptTimer;
|
|
53
|
+
/** Таймер ожидания ping в установленной сессии; обычные сообщения не продлевают ожидание. */
|
|
54
|
+
private pingTimer;
|
|
55
|
+
private pingTimeoutMs;
|
|
56
|
+
private reconnectTimeoutMs;
|
|
57
|
+
private forceWebSocket;
|
|
58
|
+
private hasEstablished;
|
|
59
|
+
private abortSignal;
|
|
60
|
+
private currentType;
|
|
61
|
+
private readonly onAbort;
|
|
62
|
+
constructor(_debug: DebugLogger | undefined, handlers: SignalingSessionHandlers);
|
|
63
|
+
get active(): boolean;
|
|
64
|
+
get established(): boolean;
|
|
65
|
+
get canSend(): boolean;
|
|
66
|
+
get type(): SignalingTransportType;
|
|
67
|
+
getPeerId(): number | null;
|
|
68
|
+
setAbortSignal(signal?: AbortSignal): void;
|
|
69
|
+
connect(connectionType: SignalingConnectionType, endpoints: {
|
|
70
|
+
endpoint: string;
|
|
71
|
+
webTransportEndpoint?: string | null;
|
|
72
|
+
}): void;
|
|
73
|
+
close(code?: number): void;
|
|
74
|
+
send(data: string): Promise<void>;
|
|
75
|
+
private _connect;
|
|
76
|
+
private _buildUrl;
|
|
77
|
+
private _onMessage;
|
|
78
|
+
private _updateRecoveryStamp;
|
|
79
|
+
private _onAbort;
|
|
80
|
+
private _retry;
|
|
81
|
+
private _disconnect;
|
|
82
|
+
private _startRetryTimer;
|
|
83
|
+
private _stopRetryTimer;
|
|
84
|
+
private _startConnectionDeadlineTimer;
|
|
85
|
+
private _stopConnectionDeadlineTimer;
|
|
86
|
+
private _startAttemptTimer;
|
|
87
|
+
private _stopAttemptTimer;
|
|
88
|
+
private _updateTimeouts;
|
|
89
|
+
private _startPingTimer;
|
|
90
|
+
private _stopPingTimer;
|
|
91
|
+
private _fail;
|
|
92
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Фичи, активные во время звонка. Уходят в метрику active_features,
|
|
3
|
+
* чтобы по ним разрезать остальную статистику: сколько фризов при включённой камере,
|
|
4
|
+
* какой битрейт при шаре и так далее.
|
|
5
|
+
*
|
|
6
|
+
* Здесь только то, что реально включено прямо сейчас, а не то, что разрешено настройками:
|
|
7
|
+
* иначе фича попадала бы в метрику у всех, кому ее просто не запретили.
|
|
8
|
+
*
|
|
9
|
+
* Сервер принимает только имена из своего списка, незнакомые отбрасывает с ошибкой.
|
|
10
|
+
* Новое имя добавляем сюда после того, как его добавят на сервере.
|
|
11
|
+
*/
|
|
12
|
+
declare enum ActiveFeature {
|
|
13
|
+
MICROPHONE = "MICROPHONE",
|
|
14
|
+
CAMERA = "CAMERA",
|
|
15
|
+
/** Любая шара экрана, в том числе быстрая */
|
|
16
|
+
SCREEN = "SCREEN",
|
|
17
|
+
ANIMOJI = "ANIMOJI"
|
|
18
|
+
}
|
|
19
|
+
export default ActiveFeature;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Коды ошибок сессии API. */
|
|
2
|
+
declare enum SessionError {
|
|
3
|
+
PARAM_SESSION_EXPIRED = 102,
|
|
4
|
+
PARAM_SESSION_KEY = 103,
|
|
5
|
+
PARAM_SIGNATURE = 104,
|
|
6
|
+
AUTH_LOGIN = 401
|
|
7
|
+
}
|
|
8
|
+
/** Ошибки, после которых имеет смысл переавторизоваться. 401 — токен хоста. */
|
|
9
|
+
export declare function isSessionErrorCode(code: unknown): boolean;
|
|
10
|
+
export default SessionError;
|
package/enums/Stat.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Имена событий статистики — поле `name` в данных `onClientStats`
|
|
3
|
+
*/
|
|
4
|
+
declare enum Stat {
|
|
2
5
|
CALL_INIT = "call_init",
|
|
3
6
|
CALL_START = "call_start",
|
|
4
7
|
CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing",
|
|
@@ -14,6 +17,14 @@ declare const enum Stat {
|
|
|
14
17
|
USER_FEEDBACK_RECEIVED = "UserFeedbackReceived",
|
|
15
18
|
SIGNALING_PING_SUMMARY = "signaling_ping_summary",
|
|
16
19
|
SIGNALING_COMMAND_SUMMARY = "signaling_command_summary",
|
|
20
|
+
API_CALL = "api_call",
|
|
21
|
+
CONNECTION_STATE_CHANGED = "connection_state_changed",
|
|
22
|
+
SIGNALING_STATE_CHANGED = "signaling_state_changed",
|
|
23
|
+
GATHERING_STATE_CHANGED = "gathering_state_changed",
|
|
24
|
+
ICE_RESTART = "ice_restart",
|
|
25
|
+
ICE_CANDIDATES_CHANGED = "ice_candidates_changed",
|
|
26
|
+
ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed",
|
|
27
|
+
ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed",
|
|
17
28
|
SDP_CREATE_OFFER = "sdp_create_offer",
|
|
18
29
|
SDP_CREATE_ANSWER = "sdp_create_answer",
|
|
19
30
|
SDP_SET_LOCAL_OFFER = "sdp_set_local_offer",
|
|
@@ -26,6 +37,8 @@ declare const enum Stat {
|
|
|
26
37
|
SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback",
|
|
27
38
|
SDP_GENERATED = "sdp_generated",
|
|
28
39
|
SDP_RECEIVED = "sdp_received",
|
|
40
|
+
CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology",
|
|
41
|
+
VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter",
|
|
29
42
|
WEBSOCKET_CONNECTED = "websocket_connected",
|
|
30
43
|
WEBSOCKET_RECONNECTED = "websocket_reconnected",
|
|
31
44
|
WEBSOCKET_FAILED_PINGS = "websocket_failed_pings",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/calls-sdk",
|
|
3
|
-
"version": "2.8.13-dev.
|
|
3
|
+
"version": "2.8.13-dev.f7edd589.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Library for video calls based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"**/*.d.ts"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vkontakte/calls-audio-effects": "1.
|
|
17
|
+
"@vkontakte/calls-audio-effects": "1.5.0",
|
|
18
18
|
"@vkontakte/calls-video-effects": "2.2.3-beta.7",
|
|
19
|
-
"@vkontakte/calls-vmoji": "1.0.10
|
|
19
|
+
"@vkontakte/calls-vmoji": "1.0.10",
|
|
20
20
|
"@vkontakte/libvpx": "2.0.9",
|
|
21
21
|
"bit-buffer": "0.2.5",
|
|
22
22
|
"fflate": "^0.8.2",
|
package/static/ApiTransport.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IAPIBaseUrl, IApiEnv } from '../types/Params';
|
|
2
2
|
export declare function resetApiEndpoint(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Убираем слэш на конце
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeApiBaseUrl(url: IAPIBaseUrl): IAPIBaseUrl;
|
|
3
7
|
export declare function _resolveApiEndpoint(apiBaseUrl?: IAPIBaseUrl, apiEnv?: IApiEnv): Promise<string>;
|
|
4
8
|
export declare function sendBeakon(method: string, params?: {
|
|
5
9
|
[key: string]: any;
|
package/static/AuthData.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExternalParticipantId } from '../types/ExternalId';
|
|
2
|
+
import type { OkUserId, ParticipantId } from '../types/Participant';
|
|
3
|
+
/** Свой участник и его внешний id */
|
|
4
|
+
export type SelfExternalId = {
|
|
5
|
+
participantId: ParticipantId;
|
|
6
|
+
externalId: ExternalParticipantId;
|
|
7
|
+
};
|
|
2
8
|
export default abstract class AuthData {
|
|
3
9
|
private static _sessionKey;
|
|
4
10
|
private static _sessionSecretKey;
|
|
5
11
|
private static _accessToken;
|
|
6
12
|
private static _userId;
|
|
13
|
+
private static _selfExternalId;
|
|
7
14
|
private static _reauthorizePromise;
|
|
8
15
|
static get sessionKey(): string | undefined;
|
|
9
16
|
static set sessionKey(value: string | undefined);
|
|
@@ -13,6 +20,9 @@ export default abstract class AuthData {
|
|
|
13
20
|
static set accessToken(value: string | undefined);
|
|
14
21
|
static get userId(): OkUserId | null;
|
|
15
22
|
static set userId(value: OkUserId | null);
|
|
23
|
+
/** Свой участник и его внешний id из ответа auth.anonymLogin */
|
|
24
|
+
static get selfExternalId(): SelfExternalId | null;
|
|
25
|
+
static set selfExternalId(value: SelfExternalId | null);
|
|
16
26
|
static isEmpty(): boolean;
|
|
17
27
|
/**
|
|
18
28
|
* Дедуплицирует одновременные попытки реавторизации из разных инстансов Api.
|