@vkontakte/calls-sdk 2.8.11-dev.7ac19827.0 → 2.8.11-dev.aeebd796.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.
@@ -41,6 +41,7 @@ export default class Conversation extends EventEmitter {
41
41
  private _pendingParticipants;
42
42
  private _transport;
43
43
  private _debugInfo;
44
+ private _debugSessionId;
44
45
  private _volumesDetector;
45
46
  private _speakerDetector;
46
47
  private _localVolumeDetector;
@@ -69,6 +70,7 @@ export default class Conversation extends EventEmitter {
69
70
  static current(): Conversation | null;
70
71
  static hangupAfterInit(): void;
71
72
  static id(): string | null;
73
+ get debugSessionId(): string | null;
72
74
  onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
73
75
  onJoin(joinArgs: {
74
76
  conversationId?: string;
@@ -10,8 +10,8 @@ export default class Logger extends BaseLogger {
10
10
  static setConversationIdProvider(provider: () => string | null): void;
11
11
  static create(api: BaseApi, externalLogger: BaseLogger | null): void;
12
12
  static log(name: StatLog, value?: string, immediately?: boolean): void;
13
- static logClientStats(params: Record<string, string | number | undefined | null>, immediately?: boolean): void;
14
- static logClientEvent(params: Record<string, string | number | undefined | null>, immediately?: boolean): void;
13
+ static logClientStats(params: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
14
+ static logClientEvent(params: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
15
15
  static destroy(): void;
16
16
  private readonly _externalLogger;
17
17
  private readonly _api;
@@ -22,8 +22,8 @@ export default class Logger extends BaseLogger {
22
22
  private _serverTimeDelta;
23
23
  constructor(api: BaseApi, externalLogger: BaseLogger | null);
24
24
  log(name: StatLog, value?: string, immediately?: boolean): void;
25
- logClientStats(data: Record<string, string | number | undefined | null>, immediately?: boolean): void;
26
- logClientEvent(data: Record<string, string | number | undefined | null>, immediately?: boolean): void;
25
+ logClientStats(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
26
+ logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
27
27
  destroy(): void;
28
28
  private _getConversationId;
29
29
  private _sendBatch;
@@ -5,6 +5,7 @@ import { TransportTopology } from '../classes/transport/Transport';
5
5
  import ConversationFeature from '../enums/ConversationFeature';
6
6
  import ConversationOption from '../enums/ConversationOption';
7
7
  import MediaOption from '../enums/MediaOption';
8
+ import SignalingCommandType from '../enums/SignalingCommandType';
8
9
  import SignalingConnectionType from '../enums/SignalingConnectionType';
9
10
  import UserRole from '../enums/UserRole';
10
11
  import { JSONObject } from '../static/Json';
@@ -20,33 +21,41 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
20
21
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
21
22
  import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
22
23
  import { PerfStatReport } from '../types/PerfStatReporter';
23
- import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
24
+ import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
24
25
  import { IPublishStreamData, IRecordConfData, IStartStreamData, IStopStreamData } from '../types/Streams';
25
26
  export default class Signaling extends BaseSignaling {
26
- private transport;
27
- private sequence;
27
+ private socket;
28
+ protected sequence: number;
28
29
  private lastStamp;
29
30
  private websocketCommandsQueue;
30
31
  private datachannelCommandsQueue;
31
32
  private incomingCache;
32
33
  private responseHandlers;
33
34
  private connectionType;
34
- private conversationResolve;
35
- private conversationReject;
35
+ private reconnectCount;
36
+ private endpoint;
37
+ private wtEndpoint;
38
+ protected conversationResolve: Function | null;
39
+ protected conversationReject: Function | null;
36
40
  private connected;
37
41
  private listenersReady;
38
- private peerId;
39
- private conversationId;
42
+ protected peerId: number | null;
43
+ protected conversationId: string | null;
44
+ private reconnectTimer;
40
45
  private connectionMessageWaitTimer;
46
+ private doctorTimer;
41
47
  private participantIdRegistry;
42
48
  private producerNotificationDataChannel;
43
49
  private producerCommandDataChannel;
44
50
  private producerCommandDataChannelEnabled;
45
51
  private producerCommandSerializationService;
52
+ private static get RECONNECT_DELAY();
53
+ private static get RECONNECT_MAX_DELAY();
54
+ private static get RECONNECT_MAX_COUNT();
46
55
  private static get WAIT_CONNECTION_DELAY();
47
56
  private static get WAIT_RESPONSE_DELAY();
57
+ private static get WAIT_MESSAGE_DELAY();
48
58
  get ready(): boolean;
49
- setAbortSignal(signal: AbortSignal | undefined): void;
50
59
  setEndpoint(endpoint: string): void;
51
60
  setWebTransportEndpoint(endpoint: string | null): void;
52
61
  setConversationId(conversationId: string): void;
@@ -62,6 +71,15 @@ export default class Signaling extends BaseSignaling {
62
71
  * Open a connection with a signaling server
63
72
  */
64
73
  connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
74
+ /**
75
+ * Send a command to a signaling server
76
+ */
77
+ protected _send<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
78
+ /**
79
+ * Send a raw command to a signaling server
80
+ */
81
+ protected _sendRaw<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
82
+ private _isDataChannelCommand;
65
83
  getNextCommandSequenceNumber(): number;
66
84
  hangup(reason: string): Promise<SignalingMessage | void>;
67
85
  sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
@@ -145,36 +163,34 @@ export default class Signaling extends BaseSignaling {
145
163
  startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
146
164
  stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
147
165
  requestAsr(request: boolean): Promise<SignalingMessage>;
148
- /**
149
- * Send a command to a signaling server
150
- */
151
- private _send;
152
- /**
153
- * Send a raw command to a signaling server
154
- */
155
- private _sendRaw;
156
- private _isDataChannelCommand;
166
+ private _buildUrl;
167
+ protected _connect(connectionType: SignalingConnectionType, useWebTransport: boolean): void;
168
+ protected _disconnect(code?: number): void;
157
169
  private _onOpen;
158
170
  private _onMessage;
159
- private _handleMessage;
171
+ protected _handleMessage(message: SignalingMessage): void;
160
172
  private _handleErrorMessage;
161
- private _handleCachedMessages;
173
+ protected _handleCachedMessages(): void;
162
174
  private _throwError;
163
175
  private _onError;
164
176
  private _serializeErrorEvent;
165
- private _onClose;
166
- private _closeSocket;
177
+ protected _onClose(event: CloseEvent): void;
178
+ protected _closeSocket(error?: Error | null): void;
179
+ protected _reconnect(): void;
167
180
  private _handleCommandResponse;
168
181
  private _handleCommandsQueue;
169
182
  private _startResponseTimer;
170
183
  private _serializeBinary;
171
184
  private _serializeJson;
172
185
  private _convertDisplayLayout;
173
- private _waitConnectionMessage;
174
- private _stopWaitConnectionMessage;
175
- private _onTransportFailed;
176
- private _onTransportReconnectScheduled;
177
- private _onTransportConnectionDead;
186
+ protected _waitConnectionMessage(): void;
187
+ protected _stopWaitConnectionMessage(): void;
188
+ /**
189
+ * Отвечает за timeout логику в WebSocket, если неполучаем никаких сообщений в течении WAIT_MESSAGE_DELAY, то запускаем реконнект
190
+ */
191
+ private _startDoctor;
192
+ private _stopDoctor;
193
+ private isWebTransportAvailable;
178
194
  private _getSocketType;
179
195
  private _markTransportStat;
180
196
  private _logTransportStat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.11-dev.7ac19827.0",
3
+ "version": "2.8.11-dev.aeebd796.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",
package/static/Debug.d.ts CHANGED
@@ -8,10 +8,10 @@ export declare enum DebugMessageType {
8
8
  ERROR = "ERROR"
9
9
  }
10
10
  declare namespace Debug {
11
- let debug: Function;
12
- let log: Function;
13
- let warn: Function;
14
- let error: Function;
11
+ function debug(...args: any[]): void;
12
+ function log(...args: any[]): void;
13
+ function warn(...args: any[]): void;
14
+ function error(...args: any[]): void;
15
15
  function enabled(): boolean;
16
16
  function toggle(enable: boolean): void;
17
17
  function send(type: DebugMessageType, ...args: any[]): void;
@@ -41,10 +41,11 @@ export interface CallStatReport {
41
41
  remote_connection_type?: RTCIceCandidateType;
42
42
  }
43
43
  export interface ICallStatLog extends Pick<CallStatReport, 'call_topology' | 'nack_sent' | 'nack_received' | 'pli_sent' | 'pli_received' | 'fir_sent' | 'fir_received' | 'frames_dropped' | 'stat_time_delta'>, Pick<Partial<CallStatReport>, 'rtt' | 'jitter_video' | 'jitter_audio' | 'interframe_delay_variance' | 'freeze_count' | 'total_freezes_duration' | 'ss_freeze_count' | 'ss_total_freezes_duration' | 'inserted_audio_samples_for_deceleration' | 'removed_audio_samples_for_acceleration' | 'concealed_audio_samples' | 'total_audio_energy' | 'local_address' | 'local_connection_type' | 'network_type' | 'transport' | 'remote_address' | 'remote_connection_type'> {
44
+ is_simulcast?: boolean;
44
45
  concealed_silent_audio_samples?: number;
45
46
  concealment_audio_avg_size?: number;
46
47
  video_loss?: number;
47
48
  audio_loss?: number;
48
49
  cpu_hardware_concurrency?: number;
49
- [k: string]: string | number | undefined;
50
+ [k: string]: string | number | boolean | undefined;
50
51
  }
@@ -7,8 +7,6 @@ declare class WebTransportEventual {
7
7
  private readonly url;
8
8
  private readonly options;
9
9
  private readonly compression;
10
- private closeRequested;
11
- private closeEventEmitted;
12
10
  private encoder;
13
11
  private decoder;
14
12
  onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
@@ -24,8 +22,6 @@ declare class WebTransportEventual {
24
22
  send(data: string): Promise<void>;
25
23
  private createErrorEvent;
26
24
  close(code?: number, reason?: string): void;
27
- private closeConnectedTransport;
28
- private emitClose;
29
25
  static isBrowserSupported(): boolean;
30
26
  }
31
27
  export { WebTransportEventual as WebTransport };
@@ -1,8 +1,108 @@
1
+ /**
2
+ * Запись отладочного лога SDK.
3
+ */
1
4
  export type CurrentLogItem = {
2
5
  readonly t: number;
3
6
  readonly l: string;
4
7
  readonly d: any[];
5
8
  readonly h: string;
6
9
  };
7
- export declare function add(level: string, args: any[]): void;
10
+ /**
11
+ * Информация о сохраненной локальной сессии логирования.
12
+ */
13
+ export type DebugLogSessionInfo = {
14
+ /**
15
+ * Внутренний id локальной сессии логирования.
16
+ */
17
+ readonly sessionId: string;
18
+ /**
19
+ * Id звонка. Может быть null, если звонок не успел стартовать.
20
+ */
21
+ readonly conversationId: string | null;
22
+ /**
23
+ * Время первой записи в ms.
24
+ */
25
+ readonly startTime: number;
26
+ /**
27
+ * Время последней записи в ms.
28
+ */
29
+ readonly endTime: number;
30
+ /**
31
+ * Время последнего обновления в ms.
32
+ */
33
+ readonly updatedAt: number;
34
+ /**
35
+ * Размер сохраненных данных в байтах.
36
+ */
37
+ readonly bytes: number;
38
+ /**
39
+ * Количество записей лога.
40
+ */
41
+ readonly entriesCount: number;
42
+ };
43
+ /**
44
+ * Статистика локального хранилища отладочных логов.
45
+ */
46
+ export type DebugLogStorageStats = {
47
+ /**
48
+ * Доступен ли IndexedDB для сохранения логов.
49
+ */
50
+ readonly supported: boolean;
51
+ /**
52
+ * Количество сохраненных звонков.
53
+ */
54
+ readonly callsCount: number;
55
+ /**
56
+ * Количество локальных сессий логирования.
57
+ */
58
+ readonly sessionsCount: number;
59
+ /**
60
+ * Размер сохраненных логов SDK в байтах.
61
+ */
62
+ readonly usedBytes: number;
63
+ /**
64
+ * Максимальный размер DebugStorage в байтах.
65
+ */
66
+ readonly maxBytes: number;
67
+ /**
68
+ * Максимальное количество звонков в DebugStorage.
69
+ */
70
+ readonly maxCalls: number;
71
+ /**
72
+ * Общая квота браузерного хранилища, если доступна.
73
+ */
74
+ readonly quotaBytes?: number;
75
+ /**
76
+ * Использование браузерного хранилища, если доступно.
77
+ */
78
+ readonly usageBytes?: number;
79
+ };
80
+ /**
81
+ * Параметры чтения или очистки локальных логов.
82
+ */
83
+ export type DebugLogGetParams = {
84
+ /**
85
+ * Id звонка. Вернет все локальные сессии с этим conversationId.
86
+ */
87
+ readonly conversationId: string;
88
+ readonly sessionId?: never;
89
+ } | {
90
+ /**
91
+ * Внутренний id локальной сессии из debugLogs.list().
92
+ */
93
+ readonly sessionId: string;
94
+ readonly conversationId?: never;
95
+ };
96
+ export declare function add(level: string, args: any[], sessionId?: string): CurrentLogItem;
8
97
  export declare function init(): void;
98
+ export declare function startSession(forceNew?: boolean): string;
99
+ export declare function setConversationId(conversationId: string | null, sessionId?: string): void;
100
+ export declare function list(): Promise<DebugLogSessionInfo[]>;
101
+ export declare function getCurrentSession(): Promise<DebugLogSessionInfo | null>;
102
+ export declare function get(params: DebugLogGetParams): Promise<CurrentLogItem[]>;
103
+ export declare function getJson(params: DebugLogGetParams): Promise<string>;
104
+ export declare function download(params: DebugLogGetParams): Promise<string>;
105
+ export declare function clear(params?: DebugLogGetParams): Promise<void>;
106
+ export declare function stats(): Promise<DebugLogStorageStats>;
107
+ export declare function getAllJson(): Promise<string>;
108
+ export declare function downloadAll(): Promise<string>;
@@ -1,3 +0,0 @@
1
- import ConversationResponse from '../types/ConversationResponse';
2
- export type ConversationResponseSource = 'startConversation' | 'joinConversation' | 'joinConversationByLink' | 'fastStart' | 'fastJoin';
3
- export declare function assertValidConversationResponse(response: ConversationResponse | null | undefined, source: ConversationResponseSource): void;
@@ -1,68 +0,0 @@
1
- import SignalingConnectionType from '../enums/SignalingConnectionType';
2
- import { SignalingTransportType } from '../enums/SignalingTransportStat';
3
- export declare enum SignalingTransportFailure {
4
- EMPTY_ENDPOINT = "EMPTY_ENDPOINT",
5
- NETWORK_ERROR = "NETWORK_ERROR",
6
- ABORTED = "ABORTED"
7
- }
8
- export type SignalingTransportFailedEvent = {
9
- failure: SignalingTransportFailure;
10
- message: string;
11
- remote?: boolean;
12
- };
13
- export type SignalingTransportReconnectEvent = {
14
- count: number;
15
- delay: number;
16
- };
17
- export type SignalingTransportHandlers = {
18
- onOpen: () => void;
19
- onMessage: (event: MessageEvent) => void;
20
- onError: (event: Event) => void;
21
- onClose: (event: CloseEvent) => void;
22
- onFailed: (event: SignalingTransportFailedEvent) => void;
23
- onReconnectScheduled: (event: SignalingTransportReconnectEvent) => void;
24
- onConnectionDead: () => void;
25
- };
26
- export default class SignalingTransport {
27
- private readonly handlers;
28
- private socket;
29
- private endpoint;
30
- private wtEndpoint;
31
- private peerId;
32
- private lastStamp;
33
- private connectionType;
34
- private reconnectCount;
35
- private reconnectTimer;
36
- private doctorTimer;
37
- private forceWebSocket;
38
- private abortSignal;
39
- private manualClose;
40
- private currentType;
41
- constructor(handlers: SignalingTransportHandlers);
42
- get readyState(): number | null;
43
- get type(): SignalingTransportType;
44
- setEndpoint(endpoint: string): void;
45
- setWebTransportEndpoint(endpoint: string | null): void;
46
- setPeerId(peerId: number | null): void;
47
- setLastStamp(lastStamp: number): void;
48
- setAbortSignal(signal?: AbortSignal): void;
49
- resetReconnectCount(): void;
50
- connect(connectionType: SignalingConnectionType): void;
51
- close(code?: number): void;
52
- send(data: string | ArrayBuffer): void;
53
- private _connect;
54
- private _connectWebTransport;
55
- private _connectWebSocket;
56
- private _setSocketHandlers;
57
- private _buildUrl;
58
- private _canUseWebTransport;
59
- private _onOpen;
60
- private _onMessage;
61
- private _onError;
62
- private _onClose;
63
- private _disconnect;
64
- private _scheduleReconnect;
65
- private _getReconnectDelay;
66
- private _startDoctor;
67
- private _stopDoctor;
68
- }
@@ -1,13 +0,0 @@
1
- import { CurrentLogItem } from '../utils/DebugStorage';
2
- export declare class ConversationDebugLogger {
3
- private static _list;
4
- private static _conversationId;
5
- static get startTime(): number;
6
- static get endTime(): number;
7
- static startSession(): void;
8
- static get conversationId(): string | null;
9
- static set conversationId(conversationId: string | null);
10
- static add(item: CurrentLogItem): void;
11
- private static _createContextLogs;
12
- static collectLogs(): CurrentLogItem[];
13
- }