@vkontakte/calls-sdk 2.8.11-dev.c0a05ac7.0 → 2.8.11-dev.d27d8de2.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.
@@ -16,7 +16,7 @@ import { ConversationData, ConversationOnStartParams } from '../types/Conversati
16
16
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
17
17
  import type { FastJoinHandler } from '../types/FastJoin';
18
18
  import MediaModifiers from '../types/MediaModifiers';
19
- import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
19
+ import { IVideoDimentions } from '../types/MediaSettings';
20
20
  import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
21
21
  import MuteStates from '../types/MuteStates';
22
22
  import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../types/Participant';
@@ -37,7 +37,6 @@ export default class Conversation extends EventEmitter {
37
37
  private _conversation;
38
38
  private _myLastRequestedLayouts;
39
39
  private _state;
40
- private _previousState;
41
40
  private _participantState;
42
41
  private _participants;
43
42
  private _pendingParticipants;
@@ -53,8 +52,10 @@ export default class Conversation extends EventEmitter {
53
52
  private _isRealTimeAsrRequested;
54
53
  private _serverSettings;
55
54
  private _serverTimeOffset;
56
- private _delayedHangup;
57
- private _abortController;
55
+ private static _current;
56
+ private static _activationMutex;
57
+ private static _delayedHangup;
58
+ private static _abortController;
58
59
  private readonly _onUnload;
59
60
  private readonly _audioOutput;
60
61
  private readonly _stats;
@@ -72,10 +73,6 @@ export default class Conversation extends EventEmitter {
72
73
  static current(): Conversation | null;
73
74
  static hangupAfterInit(): void;
74
75
  static id(): string | null;
75
- get id(): string;
76
- get externalId(): ExternalParticipantId | undefined;
77
- get mediaSettings(): MediaSettings | undefined;
78
- get isCallHeld(): boolean;
79
76
  static debugSessionId(): string | null;
80
77
  static getSyncedTime(): number;
81
78
  get debugSessionId(): string | null;
@@ -115,7 +112,7 @@ export default class Conversation extends EventEmitter {
115
112
  destroy(): Promise<void>;
116
113
  private _getConversationParams;
117
114
  private _setConversationParams;
118
- private _addGeoParamsToEndpoint;
115
+ private _buildSignalingEndpoint;
119
116
  /**
120
117
  * @throws ErrorEvent
121
118
  */
@@ -146,6 +143,7 @@ export default class Conversation extends EventEmitter {
146
143
  private _registerParticipantInCache;
147
144
  private _getExistedParticipantByIdOrCreate;
148
145
  private _getExternalIdByParticipantId;
146
+ private _getExternalIdsByOkIdsFromCache;
149
147
  private _registerParticipantAndSetMarkersIfChunkEnabled;
150
148
  private _warnParticipantNotInConversation;
151
149
  private _denormalizeMarkers;
@@ -403,7 +401,6 @@ export default class Conversation extends EventEmitter {
403
401
  private _onFeedback;
404
402
  private _onDecorativeParticipantIdChanged;
405
403
  private _onVideoSuspendSuggest;
406
- private _onParticipantHold;
407
404
  private _isMe;
408
405
  private _getMuteStatesForRoomId;
409
406
  private _getMuteStatesForCurrentRoom;
@@ -413,8 +410,6 @@ export default class Conversation extends EventEmitter {
413
410
  private _getParticipants;
414
411
  private _getParticipant;
415
412
  }
416
- declare function _resetPendingInstance(): void;
417
- export { _resetPendingInstance };
418
413
  export declare class UpdateDisplayLayoutError extends Error {
419
414
  readonly participantErrors: {
420
415
  externalId: ExternalParticipantId;
@@ -0,0 +1,3 @@
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;
@@ -47,7 +47,6 @@ export declare class MediaSource extends EventEmitter {
47
47
  /** Трек аудио эффектов. Не изменяется на протяжении всего времени */
48
48
  private _audioEffectsTrack;
49
49
  private _mediaSettings;
50
- private _lastMediaSettings;
51
50
  private _videoStatusOnScreenCapturingEnabled;
52
51
  private _effect;
53
52
  private _audioEffectParams;
@@ -68,11 +67,7 @@ export declare class MediaSource extends EventEmitter {
68
67
  getSendAudioTrack(): MediaStreamTrack | null;
69
68
  get isAnimojiRequested(): boolean;
70
69
  addTrackToPeerConnection(pc: RTCPeerConnection, observer: boolean, noDataChannel: boolean): void;
71
- /**
72
- * @deprecated Используйте гетер mediaSettings
73
- */
74
70
  getMediaSettings(): MediaSettings;
75
- get mediaSettings(): MediaSettings;
76
71
  changeDevice(kind: MediaDeviceKind): Promise<void>;
77
72
  /**
78
73
  * Установка кастомного стрима для видео, например внешний шаринг экрана
@@ -100,8 +95,6 @@ export declare class MediaSource extends EventEmitter {
100
95
  private _setEffect;
101
96
  private _stopEffect;
102
97
  destroy(): void;
103
- stopLocalMedia(): Promise<void>;
104
- resumeLocalMedia(): Promise<void>;
105
98
  toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
106
99
  disableScreenCapturing(): Promise<void>;
107
100
  private videoTrackMuteHandler;
@@ -16,8 +16,6 @@ export default class SpecListener extends EventEmitter {
16
16
  constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?: StatsLogger | null);
17
17
  destroy(): void;
18
18
  onChangeRemoteMediaSettings(participantId: ParticipantId, mediaSettings: MediaSettings): void;
19
- private _getConnectionTimeout;
20
- private _getVolumeTimeout;
21
19
  private _onTransportStateChanged;
22
20
  private _onVolumesDetected;
23
21
  private _onConnectionTimeout;
@@ -12,5 +12,7 @@ export default abstract class WorkerBase {
12
12
  protected _sendToWorker(type: string, data?: {
13
13
  [key: string]: any;
14
14
  }, transfer?: any[]): void;
15
+ private _formatWorkerError;
16
+ private _formatWorkerMessageError;
15
17
  static isBrowserSupported(): boolean;
16
18
  }
@@ -4,6 +4,7 @@ import { StatAggregator } from './StatAggregator';
4
4
  declare enum ECallType {
5
5
  DirectOutgoing = "direct_outgoing",
6
6
  DirectIncoming = "direct_incoming",
7
+ DirectJoin = "direct_join",
7
8
  ServerIncoming = "server_incoming",
8
9
  ServerJoinServer = "server_join_server",
9
10
  ServerChangeTopology = "server_change_topology"
@@ -17,8 +18,8 @@ export declare class StatFirstMediaReceived {
17
18
  constructor(statAggregator: StatAggregator);
18
19
  markAcceptCall(topology: TransportTopology): void;
19
20
  markAcceptedCall(topology?: TransportTopology): void;
20
- markParticipantJoined(topology: TransportTopology): void;
21
21
  markOnJoin(topology: TransportTopology): void;
22
+ markTopologyChanged(topology: TransportTopology): void;
22
23
  private mark;
23
24
  measure(): void;
24
25
  }
package/default/Api.d.ts CHANGED
@@ -13,6 +13,11 @@ export default class Api extends BaseApi {
13
13
  protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
14
14
  userId(participantId: ParticipantId): Promise<ExternalParticipantId>;
15
15
  authorize(): Promise<void>;
16
+ private _getAnonymLoginCacheKey;
17
+ private _getCachedAnonymLogin;
18
+ private _setCachedAnonymLogin;
19
+ private _removeCachedAnonymLogin;
20
+ private _applyAnonymLogin;
16
21
  logClientStats(items: ClientStats[]): void;
17
22
  logClientEvents(items: ClientEvent[]): void;
18
23
  uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
@@ -40,13 +45,9 @@ export default class Api extends BaseApi {
40
45
  }>;
41
46
  getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
42
47
  joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
43
- /**
44
- * NB: Не сохраняет порядок возвращаемых ID
45
- * @hidden
46
- */
47
- getExternalIdsByOkIds(uids: OkUserId[]): Promise<ExternalParticipantId[]>;
48
48
  getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
49
49
  getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
50
+ getCachedExternalIdByOkId(okId: OkUserId): ExternalParticipantId | null;
50
51
  cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
51
52
  mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
52
53
  unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
@@ -58,6 +59,5 @@ export default class Api extends BaseApi {
58
59
  hangupConversation(conversationId: string, reason?: HangupType): void;
59
60
  removeHistoryRecords(recordIds: number[]): Promise<void>;
60
61
  cleanup(): void;
61
- private _getExternalIdsByOkIds;
62
62
  getServerTime(): Promise<number>;
63
63
  }
@@ -9,7 +9,6 @@ import TransportTopology from '../enums/TransportTopology';
9
9
  import ConversationFeature from '../enums/ConversationFeature';
10
10
  import ConversationOption from '../enums/ConversationOption';
11
11
  import MediaOption from '../enums/MediaOption';
12
- import SignalingCommandType from '../enums/SignalingCommandType';
13
12
  import SignalingConnectionType from '../enums/SignalingConnectionType';
14
13
  import UserRole from '../enums/UserRole';
15
14
  import { type DebugLogger } from '../static/Debug';
@@ -26,29 +25,24 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
26
25
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
27
26
  import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
28
27
  import { PerfStatReport } from '../types/PerfStatReporter';
29
- import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
28
+ import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
30
29
  import { IPublishStreamData, IStartStreamData, IStopStreamData } from '../types/Streams';
31
30
  export default class Signaling extends BaseSignaling {
32
- private socket;
33
- protected sequence: number;
31
+ private transport;
32
+ private sequence;
34
33
  private lastStamp;
35
34
  private websocketCommandsQueue;
36
35
  private datachannelCommandsQueue;
37
36
  private incomingCache;
38
37
  private responseHandlers;
39
38
  private connectionType;
40
- private reconnectCount;
41
- private endpoint;
42
- private wtEndpoint;
43
- protected conversationResolve: Function | null;
44
- protected conversationReject: Function | null;
39
+ private conversationResolve;
40
+ private conversationReject;
45
41
  private connected;
46
42
  private listenersReady;
47
- protected peerId: number | null;
48
- protected conversationId: string | null;
49
- private reconnectTimer;
43
+ private peerId;
44
+ private conversationId;
50
45
  private connectionMessageWaitTimer;
51
- private doctorTimer;
52
46
  private participantIdRegistry;
53
47
  private producerNotificationDataChannel;
54
48
  private producerCommandDataChannel;
@@ -57,16 +51,13 @@ export default class Signaling extends BaseSignaling {
57
51
  private readonly _debug;
58
52
  private readonly _logger;
59
53
  private readonly _statAggregator;
60
- private readonly _pings;
61
- private readonly _signalingCommands;
62
- private static get RECONNECT_DELAY();
63
- private static get RECONNECT_MAX_DELAY();
64
- private static get RECONNECT_MAX_COUNT();
54
+ private readonly _statPings;
55
+ private readonly _statSignalingCommands;
65
56
  private static get WAIT_CONNECTION_DELAY();
66
57
  private static get WAIT_RESPONSE_DELAY();
67
- private static get WAIT_MESSAGE_DELAY();
68
- constructor(debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, pings?: StatPings | null, signalingCommands?: StatSignalingCommands | null);
69
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;
70
61
  setEndpoint(endpoint: string): void;
71
62
  setWebTransportEndpoint(endpoint: string | null): void;
72
63
  setConversationId(conversationId: string): void;
@@ -82,15 +73,6 @@ export default class Signaling extends BaseSignaling {
82
73
  * Open a connection with a signaling server
83
74
  */
84
75
  connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
85
- /**
86
- * Send a command to a signaling server
87
- */
88
- protected _send<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
89
- /**
90
- * Send a raw command to a signaling server
91
- */
92
- protected _sendRaw<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
93
- private _isDataChannelCommand;
94
76
  getNextCommandSequenceNumber(): number;
95
77
  hangup(reason: string): Promise<SignalingMessage | void>;
96
78
  sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
@@ -173,34 +155,36 @@ export default class Signaling extends BaseSignaling {
173
155
  startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
174
156
  stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
175
157
  requestAsr(request: boolean): Promise<SignalingMessage>;
176
- private _buildUrl;
177
- protected _connect(connectionType: SignalingConnectionType, useWebTransport: boolean): void;
178
- 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;
179
167
  private _onOpen;
180
168
  private _onMessage;
181
- protected _handleMessage(message: SignalingMessage): void;
169
+ private _handleMessage;
182
170
  private _handleErrorMessage;
183
- protected _handleCachedMessages(): void;
171
+ private _handleCachedMessages;
184
172
  private _throwError;
185
173
  private _onError;
186
174
  private _serializeErrorEvent;
187
- protected _onClose(event: CloseEvent): void;
188
- protected _closeSocket(error?: Error | null): void;
189
- protected _reconnect(): void;
175
+ private _onClose;
176
+ private _closeSocket;
190
177
  private _handleCommandResponse;
191
178
  private _handleCommandsQueue;
192
179
  private _startResponseTimer;
193
180
  private _serializeBinary;
194
181
  private _serializeJson;
195
182
  private _convertDisplayLayout;
196
- protected _waitConnectionMessage(): void;
197
- protected _stopWaitConnectionMessage(): void;
198
- /**
199
- * Отвечает за timeout логику в WebSocket, если неполучаем никаких сообщений в течении WAIT_MESSAGE_DELAY, то запускаем реконнект
200
- */
201
- private _startDoctor;
202
- private _stopDoctor;
203
- private isWebTransportAvailable;
183
+ private _waitConnectionMessage;
184
+ private _stopWaitConnectionMessage;
185
+ private _onTransportFailed;
186
+ private _onTransportReconnectScheduled;
187
+ private _onTransportConnectionDead;
204
188
  private _getSocketType;
205
189
  private _markTransportStat;
206
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;
@@ -50,7 +50,6 @@ declare enum SignalingNotification {
50
50
  ASR_STARTED = "asr-started",
51
51
  ASR_STOPPED = "asr-stopped",
52
52
  DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed",
53
- VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest",
54
- HOLD = "hold"
53
+ VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest"
55
54
  }
56
55
  export default SignalingNotification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.11-dev.c0a05ac7.0",
3
+ "version": "2.8.11-dev.d27d8de2.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",