@vkontakte/calls-sdk 2.8.13-dev.7452edd3.0 → 2.8.13-dev.77ef1766.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 +4 -4
- package/abstract/BaseApi.d.ts +1 -1
- package/calls-sdk.cjs.js +6 -6
- package/calls-sdk.esm.js +2282 -2281
- package/classes/AudioOutput.d.ts +2 -3
- package/classes/CallRegistry.d.ts +5 -2
- package/classes/MediaSource.d.ts +5 -0
- package/classes/SignalingErrors.d.ts +6 -0
- package/classes/conversation/Conversation.d.ts +6 -3
- package/classes/conversation/Conversation.testUtils.d.ts +3 -3
- package/classes/screenshare/ScreenCaptureSender.d.ts +2 -2
- package/classes/stat/CallLifecycleStats.d.ts +0 -2
- package/classes/stat/CallStatTail.d.ts +0 -11
- package/classes/stat/ConversationStats.d.ts +4 -8
- package/classes/stat/StatEventCollector.d.ts +1 -13
- package/classes/stat/StatQueue.d.ts +1 -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 +2 -2
- package/classes/transport/ServerTransport.d.ts +2 -2
- package/classes/transport/SimulcastSender.d.ts +2 -2
- package/classes/transport/Statistics.d.ts +2 -2
- package/classes/transport/Transport.d.ts +5 -5
- package/default/Api.d.ts +1 -1
- package/default/Signaling.d.ts +11 -17
- package/default/SignalingSession.d.ts +92 -0
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +1 -1
- package/static/Params.d.ts +30 -9
- package/types/AddParticipantParams.d.ts +18 -0
- package/types/ExternalId.d.ts +1 -1
- package/types/FastHangup.d.ts +4 -4
- package/types/Participant.d.ts +2 -2
- package/types/SignalingMessage.d.ts +2 -0
- package/abstract/BaseSignaling.d.ts +0 -143
- package/default/SignalingTransport.d.ts +0 -80
package/classes/AudioOutput.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type DebugLogger } from '../static/Debug';
|
|
2
|
-
import { ParticipantId } from '../types/Participant';
|
|
3
2
|
import StatEventCollector from './stat/StatEventCollector';
|
|
4
3
|
import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
5
4
|
/**
|
|
@@ -17,8 +16,8 @@ export default class AudioOutput {
|
|
|
17
16
|
private readonly _logger;
|
|
18
17
|
private _autoplayRecoveryController;
|
|
19
18
|
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
20
|
-
add(
|
|
21
|
-
remove(
|
|
19
|
+
add(trackId: string, track: MediaStreamTrack): void;
|
|
20
|
+
remove(trackId: string, track: MediaStreamTrack): void;
|
|
22
21
|
get volume(): number;
|
|
23
22
|
set volume(volume: number);
|
|
24
23
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type Conversation from './conversation';
|
|
2
1
|
import MediaSettings from '../types/MediaSettings';
|
|
2
|
+
import type Conversation from './conversation';
|
|
3
3
|
export interface HoldableConversation extends Conversation {
|
|
4
4
|
id: string;
|
|
5
5
|
hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
|
|
@@ -32,11 +32,14 @@ export declare class CallRegistry {
|
|
|
32
32
|
getActiveId(): string | null;
|
|
33
33
|
has(id: string, except?: HoldableConversation): boolean;
|
|
34
34
|
getAll(): HoldableConversation[];
|
|
35
|
+
getLive(except?: HoldableConversation): HoldableConversation[];
|
|
35
36
|
get callsLength(): number;
|
|
36
|
-
|
|
37
|
+
canAcceptIncoming(next: HoldableConversation): boolean;
|
|
38
|
+
setActive(id: string, acceptingIncoming?: boolean): Promise<void>;
|
|
37
39
|
setHold(id: string): Promise<void>;
|
|
38
40
|
switchCall(id: string): Promise<void>;
|
|
39
41
|
clear(): void;
|
|
42
|
+
private _canReplaceActive;
|
|
40
43
|
private _flushPendingRemovals;
|
|
41
44
|
}
|
|
42
45
|
declare const callRegistry: CallRegistry;
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -130,6 +130,11 @@ export declare class MediaSource extends EventEmitter {
|
|
|
130
130
|
updateNoiseSuppression(): Promise<void>;
|
|
131
131
|
videoEffect(effect: IEffect | null): Promise<void>;
|
|
132
132
|
audioEffect(audioEffectParams: AudioEffectParams | null): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Копия микрофона всегда включена: clone() копирует enabled,
|
|
135
|
+
* а VAD выключает трек микрофона, пока человек молчит
|
|
136
|
+
*/
|
|
137
|
+
private _cloneMicAudioTrack;
|
|
133
138
|
getAudioShareTrack(): MediaStreamTrack | null;
|
|
134
139
|
private handleVideoEffectsLowFps;
|
|
135
140
|
private get _frameRate();
|
|
@@ -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';
|
|
@@ -104,6 +104,7 @@ export default class Conversation extends EventEmitter {
|
|
|
104
104
|
* Внешний id звонящего во входящем звонке, либо null, если звонящий не найден.
|
|
105
105
|
*/
|
|
106
106
|
getIncomingCallerExternalId(): ExternalParticipantId | null;
|
|
107
|
+
get oneToOnePeer(): CompositeUserId | null;
|
|
107
108
|
private _buildInternalParams;
|
|
108
109
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
109
110
|
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
@@ -264,8 +265,8 @@ export default class Conversation extends EventEmitter {
|
|
|
264
265
|
private _isWaitingForPromotion;
|
|
265
266
|
private _getWaitingForPromotionStatus;
|
|
266
267
|
putHandsDown(): Promise<void>;
|
|
267
|
-
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<
|
|
268
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<
|
|
268
|
+
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<SignalingMessage>;
|
|
269
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<SignalingMessage>;
|
|
269
270
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
270
271
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
271
272
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -464,7 +465,9 @@ export default class Conversation extends EventEmitter {
|
|
|
464
465
|
private _onFeedback;
|
|
465
466
|
private _onDecorativeParticipantIdChanged;
|
|
466
467
|
private _onVideoSuspendSuggest;
|
|
468
|
+
private _reconcileParticipantHold;
|
|
467
469
|
private _onParticipantHold;
|
|
470
|
+
private _applyParticipantHold;
|
|
468
471
|
private _isMe;
|
|
469
472
|
/**
|
|
470
473
|
* Сколько человек сейчас в звонке. Считаем только принявших: приглашенные,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchMock } from 'vitest-fetch-mock';
|
|
2
2
|
import { Mock } from 'vitest';
|
|
3
3
|
import { Client, Server } from 'mock-socket';
|
|
4
|
-
import { ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
4
|
+
import { CompositeUserId, ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
5
5
|
import Api from '../../default/Api';
|
|
6
6
|
import CallDirection from '../../enums/CallDirection';
|
|
7
7
|
import ConversationOption from '../../enums/ConversationOption';
|
|
@@ -106,7 +106,7 @@ export declare function createWaitingHallConversationData(): {
|
|
|
106
106
|
asrInfoByRoom: Map<any, any>;
|
|
107
107
|
audienceMode: boolean;
|
|
108
108
|
chatId: null;
|
|
109
|
-
compositeUserId:
|
|
109
|
+
compositeUserId: `u${number}` | `g${number}`;
|
|
110
110
|
concurrent: boolean;
|
|
111
111
|
direction: CallDirection;
|
|
112
112
|
externalId: ExternalParticipantId;
|
|
@@ -147,5 +147,5 @@ export declare function createConnectionMessage(data?: Partial<SignalingMessage.
|
|
|
147
147
|
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
148
148
|
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
149
149
|
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
150
|
-
export declare function createMovieShareInfo(initiatorId:
|
|
150
|
+
export declare function createMovieShareInfo(initiatorId: CompositeUserId, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
151
151
|
export {};
|
|
@@ -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
|
* Очищает очередь до опорного кадра
|
|
@@ -12,7 +12,6 @@ export interface CallLifecycleClock {
|
|
|
12
12
|
export declare class CallLifecycleStats {
|
|
13
13
|
private readonly _logger;
|
|
14
14
|
private readonly _clock;
|
|
15
|
-
/** Хвост звонка в очереди; null — выключен */
|
|
16
15
|
private readonly _tail;
|
|
17
16
|
private _conversationId;
|
|
18
17
|
private _callStartLabel;
|
|
@@ -37,7 +36,6 @@ export declare class CallLifecycleStats {
|
|
|
37
36
|
destroy(): void;
|
|
38
37
|
private _canRecord;
|
|
39
38
|
private _durationSince;
|
|
40
|
-
/** Ведёт хвост звонка, когда известен conversationId. */
|
|
41
39
|
private _startTail;
|
|
42
40
|
private _finish;
|
|
43
41
|
private _ensureConversationId;
|
|
@@ -18,7 +18,6 @@ export interface CallStatTailClock {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class CallStatTail {
|
|
20
20
|
private static _tabId;
|
|
21
|
-
/** id вкладки, создаётся при первом обращении */
|
|
22
21
|
static get tabId(): string;
|
|
23
22
|
static lockName(key: string): string;
|
|
24
23
|
static isSupported(): boolean;
|
|
@@ -31,7 +30,6 @@ export declare class CallStatTail {
|
|
|
31
30
|
/** Первая запись хвоста; null — ещё не было или не удалась */
|
|
32
31
|
private _creation;
|
|
33
32
|
private _timer;
|
|
34
|
-
/** Отпускает замок звонка */
|
|
35
33
|
private _releaseLock;
|
|
36
34
|
/** Запросы замка подряд, которые закончились без выдачи */
|
|
37
35
|
private _lockFailures;
|
|
@@ -39,7 +37,6 @@ export declare class CallStatTail {
|
|
|
39
37
|
private _onAdopted;
|
|
40
38
|
/** @param summaries итоги звонка на текущий момент: codec_usage и сводки сигналинга */
|
|
41
39
|
constructor(logger: StatEventCollector, summaries: () => ClientStatsPayload[], clock?: CallStatTailClock);
|
|
42
|
-
/** Начинает вести хвост звонка: сначала замок, потом запись. */
|
|
43
40
|
start(vcid: string, onAdopted: () => void): void;
|
|
44
41
|
/**
|
|
45
42
|
* Звонок закончился: снимает хвост и вызывает write, который пишет
|
|
@@ -47,14 +44,6 @@ export declare class CallStatTail {
|
|
|
47
44
|
* вызывается.
|
|
48
45
|
*/
|
|
49
46
|
complete(write: () => void): void;
|
|
50
|
-
/** Снимает хвост без финиша. */
|
|
51
|
-
stop(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Вкладка закрывается: хвост остаётся в таблице как готовый финиш, замок
|
|
54
|
-
* снимаем. Писать что-то в IndexedDB из pagehide бесполезно: запись может
|
|
55
|
-
* не успеть.
|
|
56
|
-
*/
|
|
57
|
-
abandon(): void;
|
|
58
47
|
private _requestLock;
|
|
59
48
|
/** Замок держится, пока не разрешён возвращённый промис. */
|
|
60
49
|
private _onLockGranted;
|
|
@@ -22,18 +22,14 @@ export declare class ConversationStats {
|
|
|
22
22
|
readonly resources: ClientResourceStats;
|
|
23
23
|
readonly battery: BatteryStats;
|
|
24
24
|
private readonly _api;
|
|
25
|
-
/** Хвост звонка в очереди; null — выключен */
|
|
26
25
|
private readonly _tail;
|
|
27
|
-
private _unloading;
|
|
28
26
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined, resourceSources: ClientResourceSources);
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* pagehide. С очередью ничего не делаем: финиш и итоги звонка лежат в
|
|
29
|
+
* хвосте, его перенесёт другая вкладка или следующий старт SDK. Старая
|
|
30
|
+
* схема отправляет финиш сразу.
|
|
33
31
|
*/
|
|
34
|
-
|
|
35
|
-
/** Вкладка пережила pagehide: снова пишем в очередь. */
|
|
36
|
-
restoreAfterUnload(): void;
|
|
32
|
+
onPageHide(): void;
|
|
37
33
|
resetPingBaseline(): void;
|
|
38
34
|
logHangup(reason: HangupReason): void;
|
|
39
35
|
flushCallMetrics(): void;
|
|
@@ -27,29 +27,17 @@ export default class StatEventCollector extends BaseLogger {
|
|
|
27
27
|
private readonly _externalLogger;
|
|
28
28
|
private readonly _conversationIdProvider;
|
|
29
29
|
private readonly _topologyProvider;
|
|
30
|
-
private _unloadMode;
|
|
31
30
|
/** Старая схема: не null, когда ручка выключена, тогда очередь не используется. */
|
|
32
31
|
private readonly _legacy;
|
|
33
32
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null, topologyProvider?: () => TransportTopology | undefined);
|
|
34
33
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
35
|
-
/**
|
|
36
|
-
* Вкладка закрывается (pagehide): в очередь больше не пишем. Запись в
|
|
37
|
-
* IndexedDB отсюда может не успеть. А если страница уйдёт в bfcache,
|
|
38
|
-
* запись допишется после возврата и задвоит финиш из хвоста звонка.
|
|
39
|
-
* Финиш уже лежит в хвосте, его отправит другая вкладка или следующий
|
|
40
|
-
* старт SDK.
|
|
41
|
-
*/
|
|
42
|
-
enterUnloadMode(): void;
|
|
43
|
-
/** Вкладка пережила pagehide (bfcache, отменённая навигация): снова пишем в очередь. */
|
|
44
|
-
exitUnloadMode(): void;
|
|
45
34
|
logClientStats(data: ClientStatsPayload, options?: LogClientStatsOptions): void;
|
|
46
35
|
/**
|
|
47
|
-
*
|
|
36
|
+
* Собирает запись очереди, никуда её не записывая и не вызывая onClientStats.
|
|
48
37
|
* null — старая схема, uid неизвестен или в памяти ждут события без uid.
|
|
49
38
|
*/
|
|
50
39
|
buildEntry(data: ClientStatsPayload, options?: LogClientStatsOptions): StatQueueEntry | null;
|
|
51
40
|
destroy(): void;
|
|
52
|
-
/** Собирает запись очереди без владельца: conversationId, время, поправку и данные события. */
|
|
53
41
|
private _makeEntry;
|
|
54
42
|
private _store;
|
|
55
43
|
private _getConversationId;
|
|
@@ -30,7 +30,7 @@ export type StatTail = {
|
|
|
30
30
|
key: string;
|
|
31
31
|
uid: number;
|
|
32
32
|
vcid: string;
|
|
33
|
-
/**
|
|
33
|
+
/** Время финиша в хвосте, device-time. */
|
|
34
34
|
ts: number;
|
|
35
35
|
entries: StatQueueEntry[];
|
|
36
36
|
};
|
|
@@ -108,7 +108,6 @@ export default abstract class StatQueue {
|
|
|
108
108
|
* получает первую из таблиц и саму транзакцию — для остальных.
|
|
109
109
|
*/
|
|
110
110
|
private static _runTransaction;
|
|
111
|
-
/** Результат запроса внутри транзакции. */
|
|
112
111
|
private static _request;
|
|
113
112
|
/** Читает запись с минимальным id, то есть самую старую в хранилище. */
|
|
114
113
|
private static _readOldestRecord;
|
|
@@ -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';
|
|
@@ -18,7 +18,7 @@ export default class PerfStatReporter extends EventEmitter {
|
|
|
18
18
|
private readonly _directTopology;
|
|
19
19
|
private readonly _debug;
|
|
20
20
|
private readonly _statAggregator;
|
|
21
|
-
constructor(transport: ServerTransport | DirectTransport, signaling:
|
|
21
|
+
constructor(transport: ServerTransport | DirectTransport, signaling: Signaling, statAggregator?: StatAggregator | null, directTopology?: boolean, debug?: DebugLogger);
|
|
22
22
|
destroy(): void;
|
|
23
23
|
static getEstimatedPerformanceIndex(): number;
|
|
24
24
|
private _handleStats;
|
|
@@ -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;
|
|
@@ -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 }?: {
|
|
@@ -12,13 +12,13 @@ declare function extractTransport(stats: RTCStats[]): StatTransport;
|
|
|
12
12
|
* Extracts media statistics from the given stats
|
|
13
13
|
* @hidden
|
|
14
14
|
*/
|
|
15
|
-
declare function extractRtps(stats: RTCStats[], ssrcMap: Record<string, string
|
|
15
|
+
declare function extractRtps(stats: RTCStats[], ssrcMap: Partial<Record<string, string>>, needToExtractRemote?: boolean): StatRtp[];
|
|
16
16
|
/**
|
|
17
17
|
* Computes delta (the difference) between two stat reports.
|
|
18
18
|
* @hidden
|
|
19
19
|
*/
|
|
20
20
|
declare function delta(current: StatItem, previous: StatItem, needToExtractRemote?: boolean): StatItem;
|
|
21
|
-
declare function collectStats(pc: RTCPeerConnection, previous: StatItem | null, ssrcMap?: Record<string, string
|
|
21
|
+
declare function collectStats(pc: RTCPeerConnection, previous: StatItem | null, ssrcMap?: Partial<Record<string, string>>, needToExtractRemote?: boolean): Promise<StatItem>;
|
|
22
22
|
declare function setMark(name: string): void;
|
|
23
23
|
declare function clearMark(name: string): void;
|
|
24
24
|
declare function measureMark(name: string): null | number;
|
|
@@ -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;
|
|
@@ -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
|
@@ -68,7 +68,7 @@ export default class Api extends BaseApi {
|
|
|
68
68
|
getConversationParams(conversationId?: string): Promise<ConversationParams>;
|
|
69
69
|
getUserId(): OkUserId | null;
|
|
70
70
|
setUserId(userId: OkUserId): void;
|
|
71
|
-
hangupConversation(conversationId: string, reason?: HangupType, params?: Partial<IHangupParams>):
|
|
71
|
+
hangupConversation(conversationId: string, reason?: HangupType, params?: Partial<IHangupParams>): Promise<boolean>;
|
|
72
72
|
removeHistoryRecords(recordIds: number[]): Promise<void>;
|
|
73
73
|
cleanup(): void;
|
|
74
74
|
getServerTime(): Promise<number>;
|
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,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,12 +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
|
-
private peerId;
|
|
45
45
|
/** Когда началась череда падений соединения, от неё считаем *_timeout */
|
|
46
46
|
private reconnectStartedAt;
|
|
47
|
-
private connectionMessageWaitTimer;
|
|
48
47
|
private participantIdRegistry;
|
|
49
48
|
private producerNotificationDataChannel;
|
|
50
49
|
private producerCommandDataChannel;
|
|
@@ -55,13 +54,10 @@ export default class Signaling extends BaseSignaling {
|
|
|
55
54
|
private readonly _statAggregator;
|
|
56
55
|
private readonly _statPings;
|
|
57
56
|
private readonly _statSignalingCommands;
|
|
58
|
-
private static get WAIT_CONNECTION_DELAY();
|
|
59
57
|
private static get WAIT_RESPONSE_DELAY();
|
|
60
58
|
get ready(): boolean;
|
|
61
59
|
constructor(debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, statPings?: StatPings | null, statSignalingCommands?: StatSignalingCommands | null);
|
|
62
60
|
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
63
|
-
setEndpoint(endpoint: string): void;
|
|
64
|
-
setWebTransportEndpoint(endpoint: string | null): void;
|
|
65
61
|
setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
|
|
66
62
|
setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
|
|
67
63
|
setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
|
|
@@ -70,7 +66,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
70
66
|
/**
|
|
71
67
|
* Open a connection with a signaling server
|
|
72
68
|
*/
|
|
73
|
-
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
69
|
+
connect(connectionType: SignalingConnectionType, conversation: ConversationResponse): Promise<SignalingMessage.Connection>;
|
|
74
70
|
getNextCommandSequenceNumber(): number;
|
|
75
71
|
hangup(reason: string): Promise<SignalingMessage>;
|
|
76
72
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
@@ -81,7 +77,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
81
77
|
changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<SignalingMessage>;
|
|
82
78
|
hold(hold: boolean): Promise<SignalingMessage>;
|
|
83
79
|
putHandsDown(): Promise<SignalingMessage>;
|
|
84
|
-
addParticipant(externalIds:
|
|
80
|
+
addParticipant(externalIds: ExternalUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
|
|
85
81
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<SignalingMessage>;
|
|
86
82
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<SignalingMessage>;
|
|
87
83
|
allocateConsumer(description: RTCSessionDescription | null, capabilities: {
|
|
@@ -180,14 +176,12 @@ export default class Signaling extends BaseSignaling {
|
|
|
180
176
|
private _serializeBinary;
|
|
181
177
|
private _serializeJson;
|
|
182
178
|
private _convertDisplayLayout;
|
|
183
|
-
private _waitConnectionMessage;
|
|
184
|
-
private _stopWaitConnectionMessage;
|
|
185
179
|
private _onTransportConnecting;
|
|
186
|
-
private
|
|
187
|
-
private
|
|
180
|
+
private _onSessionFailed;
|
|
181
|
+
private _onSessionReconnectScheduled;
|
|
188
182
|
/** Попыток восстановить соединение больше не будет: отправляем, сколько длилась череда падений */
|
|
189
183
|
private _logReconnectTimeout;
|
|
190
|
-
private
|
|
184
|
+
private _onSessionInactive;
|
|
191
185
|
private _attachNotificationCallError;
|
|
192
186
|
private _createSignalingCallError;
|
|
193
187
|
private _getSocketType;
|
|
@@ -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
|
+
}
|
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.77ef1766.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",
|