@vkontakte/calls-sdk 2.8.11-dev.aeebd796.0 → 2.8.11-dev.b9508cee.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.
Files changed (75) hide show
  1. package/CallsSDK.d.ts +29 -38
  2. package/abstract/BaseApi.d.ts +5 -8
  3. package/abstract/BaseSignaling.d.ts +5 -7
  4. package/calls-sdk.cjs.js +9 -9
  5. package/calls-sdk.esm.js +4625 -3776
  6. package/classes/AudioFix.d.ts +5 -1
  7. package/classes/AudioOutput.d.ts +5 -1
  8. package/classes/CallRegistry.d.ts +26 -0
  9. package/classes/Conversation.d.ts +45 -13
  10. package/classes/ConversationResponseValidator.d.ts +3 -0
  11. package/classes/DebugInfo.d.ts +3 -0
  12. package/classes/DisplayLayoutRequester.d.ts +39 -0
  13. package/classes/ExternalIdCache.d.ts +19 -0
  14. package/classes/MediaSource.d.ts +12 -1
  15. package/classes/ParticipantIdRegistry.d.ts +3 -0
  16. package/classes/ProducerCommandSerializationService.d.ts +3 -0
  17. package/classes/SignalingActor.d.ts +3 -1
  18. package/classes/SpeakerDetector.d.ts +2 -1
  19. package/classes/SpecListener.d.ts +10 -1
  20. package/classes/{Logger.d.ts → StatsLogger.d.ts} +3 -13
  21. package/classes/VideoEffectsFpsLimiter.d.ts +3 -0
  22. package/classes/asr/AsrReceiver.d.ts +3 -1
  23. package/classes/codec/LibVPxDecoder.d.ts +3 -0
  24. package/classes/codec/LibVPxEncoder.d.ts +3 -1
  25. package/classes/codec/WebCodecsDecoder.d.ts +3 -0
  26. package/classes/codec/WebCodecsEncoder.d.ts +3 -1
  27. package/classes/codec/WorkerBase.d.ts +7 -0
  28. package/classes/screenshare/BaseStreamBuilder.d.ts +4 -1
  29. package/classes/screenshare/CanvasRenderer.d.ts +3 -1
  30. package/classes/screenshare/ScreenCaptureReceiver.d.ts +7 -1
  31. package/classes/screenshare/ScreenCaptureSender.d.ts +5 -1
  32. package/classes/screenshare/ScreenCongestionControl.d.ts +3 -1
  33. package/classes/screenshare/StreamBuilder.d.ts +5 -1
  34. package/classes/screenshare/TrackGeneratorRenderer.d.ts +3 -1
  35. package/classes/screenshare/WebmBuilder.d.ts +3 -1
  36. package/classes/stat/CodecStatsAggregator.d.ts +7 -7
  37. package/classes/stat/ConversationStats.d.ts +21 -0
  38. package/classes/stat/StatAggregator.d.ts +6 -6
  39. package/classes/stat/StatFirstMediaReceived.d.ts +6 -2
  40. package/classes/stat/StatPings.d.ts +9 -9
  41. package/classes/stat/StatScreenShareFirstFrame.d.ts +3 -1
  42. package/classes/stat/StatSignalingCommands.d.ts +8 -8
  43. package/classes/transport/BaseTransport.d.ts +1 -1
  44. package/classes/transport/DirectStatReporter.d.ts +3 -1
  45. package/classes/transport/DirectTransport.d.ts +12 -1
  46. package/classes/transport/PerfStatReporter.d.ts +5 -1
  47. package/classes/transport/ServerTransport.d.ts +10 -2
  48. package/classes/transport/Transport.d.ts +13 -14
  49. package/default/Api.d.ts +12 -19
  50. package/default/Signaling.d.ts +39 -45
  51. package/default/SignalingTransport.d.ts +68 -0
  52. package/enums/HangupType.d.ts +2 -1
  53. package/enums/SignalingNotification.d.ts +3 -1
  54. package/enums/TransportState.d.ts +10 -0
  55. package/enums/TransportTopology.d.ts +5 -0
  56. package/package.json +1 -1
  57. package/static/Capabilities.d.ts +5 -0
  58. package/static/Debug.d.ts +27 -8
  59. package/static/External.d.ts +146 -71
  60. package/static/Params.d.ts +106 -78
  61. package/static/ParticipantConnectionStatusUtils.d.ts +16 -0
  62. package/static/Utils.d.ts +3 -2
  63. package/static/WebRTCUtils.d.ts +6 -4
  64. package/types/Capabilities.d.ts +24 -0
  65. package/types/Conversation.d.ts +1 -1
  66. package/types/ExternalId.d.ts +1 -1
  67. package/types/FastStart.d.ts +1 -0
  68. package/types/Participant.d.ts +12 -1
  69. package/types/ParticipantLayout.d.ts +33 -0
  70. package/types/PushData.d.ts +3 -0
  71. package/types/SignalingMessage.d.ts +19 -2
  72. package/types/Statistics.d.ts +1 -1
  73. package/types/WebTransport.d.ts +4 -0
  74. package/utils/DebugStorage.d.ts +1 -2
  75. package/classes/stat/EventMetricsService.d.ts +0 -9
@@ -1,13 +1,17 @@
1
1
  import BaseSignaling, { AddParticipantParams } from '../abstract/BaseSignaling';
2
+ import StatsLogger from '../classes/StatsLogger';
2
3
  import { ParticipantIdRegistry } from '../classes/ParticipantIdRegistry';
3
4
  import { SharingStatReport } from '../classes/screenshare/SharingStatReport';
4
- import { TransportTopology } from '../classes/transport/Transport';
5
+ import { StatAggregator } from '../classes/stat/StatAggregator';
6
+ import { StatPings } from '../classes/stat/StatPings';
7
+ import { StatSignalingCommands } from '../classes/stat/StatSignalingCommands';
8
+ import TransportTopology from '../enums/TransportTopology';
5
9
  import ConversationFeature from '../enums/ConversationFeature';
6
10
  import ConversationOption from '../enums/ConversationOption';
7
11
  import MediaOption from '../enums/MediaOption';
8
- import SignalingCommandType from '../enums/SignalingCommandType';
9
12
  import SignalingConnectionType from '../enums/SignalingConnectionType';
10
13
  import UserRole from '../enums/UserRole';
14
+ import { type DebugLogger } from '../static/Debug';
11
15
  import { JSONObject } from '../static/Json';
12
16
  import { IAsrStartParams, IAsrStopParams } from '../types/Asr';
13
17
  import { ChangeSimulcast } from '../types/ChangeSimulcast';
@@ -21,41 +25,39 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
21
25
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
22
26
  import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
23
27
  import { PerfStatReport } from '../types/PerfStatReporter';
24
- import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
25
- import { IPublishStreamData, IRecordConfData, IStartStreamData, IStopStreamData } from '../types/Streams';
28
+ import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
29
+ import { IPublishStreamData, IStartStreamData, IStopStreamData } from '../types/Streams';
26
30
  export default class Signaling extends BaseSignaling {
27
- private socket;
28
- protected sequence: number;
31
+ private transport;
32
+ private sequence;
29
33
  private lastStamp;
30
34
  private websocketCommandsQueue;
31
35
  private datachannelCommandsQueue;
32
36
  private incomingCache;
33
37
  private responseHandlers;
34
38
  private connectionType;
35
- private reconnectCount;
36
- private endpoint;
37
- private wtEndpoint;
38
- protected conversationResolve: Function | null;
39
- protected conversationReject: Function | null;
39
+ private conversationResolve;
40
+ private conversationReject;
40
41
  private connected;
41
42
  private listenersReady;
42
- protected peerId: number | null;
43
- protected conversationId: string | null;
44
- private reconnectTimer;
43
+ private peerId;
44
+ private conversationId;
45
45
  private connectionMessageWaitTimer;
46
- private doctorTimer;
47
46
  private participantIdRegistry;
48
47
  private producerNotificationDataChannel;
49
48
  private producerCommandDataChannel;
50
49
  private producerCommandDataChannelEnabled;
51
50
  private producerCommandSerializationService;
52
- private static get RECONNECT_DELAY();
53
- private static get RECONNECT_MAX_DELAY();
54
- private static get RECONNECT_MAX_COUNT();
51
+ private readonly _debug;
52
+ private readonly _logger;
53
+ private readonly _statAggregator;
54
+ private readonly _statPings;
55
+ private readonly _statSignalingCommands;
55
56
  private static get WAIT_CONNECTION_DELAY();
56
57
  private static get WAIT_RESPONSE_DELAY();
57
- private static get WAIT_MESSAGE_DELAY();
58
58
  get ready(): boolean;
59
+ constructor(debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, statPings?: StatPings | null, statSignalingCommands?: StatSignalingCommands | null);
60
+ setAbortSignal(signal: AbortSignal | undefined): void;
59
61
  setEndpoint(endpoint: string): void;
60
62
  setWebTransportEndpoint(endpoint: string | null): void;
61
63
  setConversationId(conversationId: string): void;
@@ -71,15 +73,6 @@ export default class Signaling extends BaseSignaling {
71
73
  * Open a connection with a signaling server
72
74
  */
73
75
  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;
83
76
  getNextCommandSequenceNumber(): number;
84
77
  hangup(reason: string): Promise<SignalingMessage | void>;
85
78
  sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
@@ -119,7 +112,6 @@ export default class Signaling extends BaseSignaling {
119
112
  startStream(data: IStartStreamData): Promise<SignalingMessage>;
120
113
  stopStream(data?: IStopStreamData): Promise<SignalingMessage>;
121
114
  publishStream(data?: IPublishStreamData): Promise<SignalingMessage>;
122
- recordSetConf(conf?: IRecordConfData): Promise<SignalingMessage>;
123
115
  getRecordStatus(): Promise<SignalingMessage>;
124
116
  switchTopology(topology: TransportTopology, force?: boolean): Promise<SignalingMessage>;
125
117
  requestRealloc(): Promise<SignalingMessage>;
@@ -163,34 +155,36 @@ export default class Signaling extends BaseSignaling {
163
155
  startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
164
156
  stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
165
157
  requestAsr(request: boolean): Promise<SignalingMessage>;
166
- private _buildUrl;
167
- protected _connect(connectionType: SignalingConnectionType, useWebTransport: boolean): void;
168
- protected _disconnect(code?: number): void;
158
+ /**
159
+ * Send a command to a signaling server
160
+ */
161
+ private _send;
162
+ /**
163
+ * Send a raw command to a signaling server
164
+ */
165
+ private _sendRaw;
166
+ private _isDataChannelCommand;
169
167
  private _onOpen;
170
168
  private _onMessage;
171
- protected _handleMessage(message: SignalingMessage): void;
169
+ private _handleMessage;
172
170
  private _handleErrorMessage;
173
- protected _handleCachedMessages(): void;
171
+ private _handleCachedMessages;
174
172
  private _throwError;
175
173
  private _onError;
176
174
  private _serializeErrorEvent;
177
- protected _onClose(event: CloseEvent): void;
178
- protected _closeSocket(error?: Error | null): void;
179
- protected _reconnect(): void;
175
+ private _onClose;
176
+ private _closeSocket;
180
177
  private _handleCommandResponse;
181
178
  private _handleCommandsQueue;
182
179
  private _startResponseTimer;
183
180
  private _serializeBinary;
184
181
  private _serializeJson;
185
182
  private _convertDisplayLayout;
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;
183
+ private _waitConnectionMessage;
184
+ private _stopWaitConnectionMessage;
185
+ private _onTransportFailed;
186
+ private _onTransportReconnectScheduled;
187
+ private _onTransportConnectionDead;
194
188
  private _getSocketType;
195
189
  private _markTransportStat;
196
190
  private _logTransportStat;
@@ -0,0 +1,68 @@
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
+ }
@@ -53,6 +53,7 @@ declare enum HangupType {
53
53
  * - Приложение вызываемого не запущено или упало
54
54
  * - Брандмауэр или сетевые ограничения блокируют подключение
55
55
  */
56
- CALL_TIMEOUT = "CALL_TIMEOUT"
56
+ CALL_TIMEOUT = "CALL_TIMEOUT",
57
+ OBSOLETE_CLIENT = "OBSOLETE_CLIENT"
57
58
  }
58
59
  export default HangupType;
@@ -24,6 +24,7 @@ declare enum SignalingNotification {
24
24
  REALLOC_CON = "realloc-con",
25
25
  AUDIO_ACTIVITY = "audio-activity",
26
26
  SPEAKER_CHANGED = "speaker-changed",
27
+ SESSION_STATE = "session-state",
27
28
  STALLED_ACTIVITY = "stalled-activity",
28
29
  CHAT_MESSAGE = "chat-message",
29
30
  CUSTOM_DATA = "custom-data",
@@ -50,6 +51,7 @@ declare enum SignalingNotification {
50
51
  ASR_STARTED = "asr-started",
51
52
  ASR_STOPPED = "asr-stopped",
52
53
  DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed",
53
- VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest"
54
+ VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest",
55
+ HOLD = "hold"
54
56
  }
55
57
  export default SignalingNotification;
@@ -0,0 +1,10 @@
1
+ declare const enum TransportState {
2
+ IDLE = "IDLE",
3
+ OPENED = "OPENED",
4
+ CONNECTING = "CONNECTING",
5
+ RECONNECTING = "RECONNECTING",
6
+ CONNECTED = "CONNECTED",
7
+ CLOSED = "CLOSED",
8
+ FAILED = "FAILED"
9
+ }
10
+ export default TransportState;
@@ -0,0 +1,5 @@
1
+ declare const enum TransportTopology {
2
+ DIRECT = "DIRECT",
3
+ SERVER = "SERVER"
4
+ }
5
+ export default TransportTopology;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.11-dev.aeebd796.0",
3
+ "version": "2.8.11-dev.b9508cee.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",
@@ -0,0 +1,5 @@
1
+ import { TCapabilities } from '../types/Capabilities';
2
+ declare namespace Capabilities {
3
+ function get(): TCapabilities;
4
+ }
5
+ export default Capabilities;
package/static/Debug.d.ts CHANGED
@@ -7,14 +7,33 @@ export declare enum DebugMessageType {
7
7
  WARN = "WARN",
8
8
  ERROR = "ERROR"
9
9
  }
10
+ export type DebugMessageContext = {
11
+ readonly sessionId: string | null;
12
+ readonly conversationId: string | null;
13
+ };
14
+ export type DebugLogger = {
15
+ debug(...args: any[]): void;
16
+ log(...args: any[]): void;
17
+ warn(...args: any[]): void;
18
+ error(...args: any[]): void;
19
+ };
20
+ export type DebugSessionLogger = DebugLogger & {
21
+ readonly sessionId: string | null;
22
+ readonly conversationId: string | null;
23
+ setConversationId(conversationId: string | null): void;
24
+ };
10
25
  declare namespace Debug {
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
- function enabled(): boolean;
16
- function toggle(enable: boolean): void;
17
- function send(type: DebugMessageType, ...args: any[]): void;
18
- function test(tag: string, ...args: any[]): void;
26
+ type ContextProvider = () => DebugMessageContext;
27
+ export function debug(...args: any[]): void;
28
+ export function log(...args: any[]): void;
29
+ export function warn(...args: any[]): void;
30
+ export function error(...args: any[]): void;
31
+ export function enabled(): boolean;
32
+ export function toggle(enable: boolean): void;
33
+ export function send(type: DebugMessageType, ...args: any[]): void;
34
+ export function createLogger(getContext: ContextProvider): DebugLogger;
35
+ export function createSessionLogger(initialConversationId?: string | null): DebugSessionLogger;
36
+ export function test(tag: string, ...args: any[]): void;
37
+ export {};
19
38
  }
20
39
  export default Debug;