@vkontakte/calls-sdk 2.8.13-dev.c9243c68.0 → 2.8.13-dev.da97cd25.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.
@@ -1,20 +1,16 @@
1
1
  import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
2
- import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
2
+ import { ParticipantId } from '../types/Participant';
3
3
  export declare class ExternalIdCache {
4
4
  private static _normalizeType;
5
- private _okIdToExternalId;
6
- private _externalIdToOkId;
5
+ private _participantIdToExternalId;
6
+ private _externalIdToParticipantId;
7
7
  private _decorativeIdToInitialId;
8
8
  private _initialIdToDecorativeId;
9
- getOkId(externalId: ExternalId): OkUserId | null;
10
- getExternalId(okId: OkUserId): ExternalParticipantId | null;
11
- hasByExternalId(externalId: ExternalId): boolean;
12
- hasByOkId(okId: OkUserId): boolean;
13
- cache(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
14
- mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
15
- unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
16
- getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
17
- replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
18
- getParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
9
+ getExternalId(participantId: ParticipantId): ExternalParticipantId | null;
10
+ getParticipantId(externalId: ExternalId): ParticipantId | null;
11
+ cache(participantId: ParticipantId, externalId: ExternalParticipantId): void;
12
+ mapDecorativeId(decorativeId: ParticipantId, initialId: ParticipantId): void;
13
+ unmapDecorativeId(initialId: ParticipantId): void;
14
+ getDecorativeIdByInitialId(initialId: ParticipantId): ParticipantId | undefined;
19
15
  clear(): void;
20
16
  }
@@ -20,7 +20,7 @@ import MediaModifiers from '../../types/MediaModifiers';
20
20
  import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
21
21
  import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
22
22
  import MuteStates from '../../types/MuteStates';
23
- import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '../../types/Participant';
23
+ import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../../types/Participant';
24
24
  import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
25
25
  import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
26
26
  import ParticipantPriority from '../../types/ParticipantPriority';
@@ -91,7 +91,8 @@ export default class Conversation extends EventEmitter {
91
91
  static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
92
92
  static getSyncedTime(): number;
93
93
  get debugSessionId(): string | null;
94
- getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
94
+ getCachedParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
95
+ private _onNonFatalError;
95
96
  /**
96
97
  * Внешний id звонящего во входящем звонке, либо null, если звонящий не найден.
97
98
  */
@@ -169,8 +170,9 @@ export default class Conversation extends EventEmitter {
169
170
  private _registerParticipantInCache;
170
171
  private _getExistedParticipantByIdOrCreate;
171
172
  private _getExternalIdByParticipantId;
172
- private _getExternalIdsByOkIdsFromCache;
173
- private _getOrCacheExternalIdByCompositeId;
173
+ private _getExternalIdsByParticipantIds;
174
+ private _reportMissingExternalIds;
175
+ private _reportMissingExternalIdsById;
174
176
  private _registerParticipantAndSetMarkersIfChunkEnabled;
175
177
  private _warnParticipantNotInConversation;
176
178
  private _denormalizeMarkers;
@@ -35,6 +35,8 @@ declare function createParams(): {
35
35
  onChatRoomUpdated: Mock<import("@vitest/spy").Procedure>;
36
36
  onRemoteStatus: Mock<import("@vitest/spy").Procedure>;
37
37
  onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
38
+ onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
39
+ onNonFatalError: Mock<import("@vitest/spy").Procedure>;
38
40
  };
39
41
  export type ConversationTestParams = ReturnType<typeof createParams>;
40
42
  export type ConversationTestTools = {
@@ -8,6 +8,7 @@ type DisplayLayoutRequesterParams = {
8
8
  getParticipants: () => Record<ParticipantId, Participant>;
9
9
  isMe: (participantId: ParticipantId) => boolean;
10
10
  updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
11
+ onNonFatalError: (message: string) => void;
11
12
  };
12
13
  export default class DisplayLayoutRequester {
13
14
  private readonly _api;
@@ -15,6 +16,7 @@ export default class DisplayLayoutRequester {
15
16
  private readonly _getParticipants;
16
17
  private readonly _isMe;
17
18
  private readonly _updateDisplayLayout;
19
+ private readonly _onNonFatalError;
18
20
  private _requestedLayouts;
19
21
  private _uncertainLayouts;
20
22
  private _pendingRequests;
@@ -25,7 +27,7 @@ export default class DisplayLayoutRequester {
25
27
  private _lastFlushAt;
26
28
  private _generation;
27
29
  private _forceNextFlush;
28
- constructor({ api, debug, getParticipants, isMe, updateDisplayLayout }: DisplayLayoutRequesterParams);
30
+ constructor({ api, debug, getParticipants, isMe, updateDisplayLayout, onNonFatalError }: DisplayLayoutRequesterParams);
29
31
  request(requests: DisplayLayoutRequest[]): Promise<void>;
30
32
  resend(): void;
31
33
  cleanupParticipant(participantId: ParticipantId): void;
@@ -0,0 +1,19 @@
1
+ import { StatAggregator } from './StatAggregator';
2
+ /** Стата жизненного цикла RTCPeerConnection */
3
+ export declare class PeerConnectionStats {
4
+ private readonly _statAggregator;
5
+ private _pc;
6
+ private _lastSignalingStateChange;
7
+ private _lastGatheringStateChange;
8
+ private readonly _handleConnectionStateChange;
9
+ private readonly _handleSignalingStateChange;
10
+ private readonly _handleGatheringStateChange;
11
+ private readonly _handleIceCandidateError;
12
+ constructor(statAggregator: StatAggregator | null);
13
+ observe(pc: RTCPeerConnection): void;
14
+ stop(): void;
15
+ logIceRestart(): void;
16
+ logIceCandidateAddFailed(candidate: RTCIceCandidateInit, error: unknown): void;
17
+ private _sinceLastChange;
18
+ private _log;
19
+ }
@@ -39,6 +39,7 @@ export default class DirectTransport extends BaseTransport {
39
39
  private _lastBadConnection;
40
40
  private _perfStatReporter;
41
41
  private _directStatReporter;
42
+ private readonly _peerConnectionStats;
42
43
  private readonly _debug;
43
44
  private readonly _logger;
44
45
  private readonly _statAggregator;
@@ -10,6 +10,7 @@ export default class PerfStatReporter extends EventEmitter {
10
10
  private _previousCallStatReportTimestamp;
11
11
  private _previousCallStatReport;
12
12
  private _previousRemoteInboundRtps;
13
+ private _previousCandidatePair;
13
14
  private _screenShareStats;
14
15
  private _signaling;
15
16
  private readonly _directTopology;
@@ -22,6 +23,7 @@ export default class PerfStatReporter extends EventEmitter {
22
23
  private reportPerfStats;
23
24
  private reportNetworkStats;
24
25
  private _reportCallStats;
26
+ private _reportCandidatePair;
25
27
  private _calculatePacketLoss;
26
28
  private _handleScreenSharingStat;
27
29
  private _handleTransportStateChanged;
@@ -45,6 +45,7 @@ export default class ServerTransport extends BaseTransport {
45
45
  private readonly _debug;
46
46
  private readonly _logger;
47
47
  private readonly _statAggregator;
48
+ private readonly _peerConnectionStats;
48
49
  private readonly _codecStatsAggregator;
49
50
  private readonly _simulcast;
50
51
  constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
package/default/Api.d.ts CHANGED
@@ -5,14 +5,14 @@ import { IHangupParams } from '../types/Api';
5
5
  import ConversationParams from '../types/ConversationParams';
6
6
  import ConversationResponse from '../types/ConversationResponse';
7
7
  import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
8
- import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
8
+ import { OkUserId, ParticipantId } from '../types/Participant';
9
9
  import PushData from '../types/PushData';
10
10
  export default class Api extends BaseApi {
11
11
  private _uuid;
12
12
  private _idCache;
13
13
  private _callUnsafe;
14
14
  protected _call(method: string, data?: any, noSession?: boolean, allowReauthorize?: boolean): Promise<any>;
15
- userId(participantId: ParticipantId): ExternalParticipantId;
15
+ userId(participantId: ParticipantId): ExternalParticipantId | null;
16
16
  authorize(): Promise<void>;
17
17
  private _getAnonymLoginCacheKey;
18
18
  private _getCachedAnonymLogin;
@@ -47,14 +47,12 @@ export default class Api extends BaseApi {
47
47
  }>;
48
48
  getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
49
49
  joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
50
- getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
51
- getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
52
- getCachedExternalIdByOkId(okId: OkUserId): ExternalParticipantId | null;
53
- cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
54
- mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
55
- unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
56
- getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
57
- replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
50
+ getCachedParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
51
+ getCachedExternalIdByParticipantId(participantId: ParticipantId): ExternalParticipantId | null;
52
+ cacheExternalId(participantId: ParticipantId, externalId: ExternalParticipantId): void;
53
+ mapDecorativeId(decorativeId: ParticipantId, initialId: ParticipantId): void;
54
+ unmapDecorativeId(initialId: ParticipantId): void;
55
+ getDecorativeIdByInitialId(initialId: ParticipantId): ParticipantId | undefined;
58
56
  getConversationParams(conversationId?: string): Promise<ConversationParams>;
59
57
  getUserId(): OkUserId | null;
60
58
  setUserId(userId: OkUserId): void;
package/enums/Stat.d.ts CHANGED
@@ -14,6 +14,13 @@ declare const enum Stat {
14
14
  USER_FEEDBACK_RECEIVED = "UserFeedbackReceived",
15
15
  SIGNALING_PING_SUMMARY = "signaling_ping_summary",
16
16
  SIGNALING_COMMAND_SUMMARY = "signaling_command_summary",
17
+ CONNECTION_STATE_CHANGED = "connection_state_changed",
18
+ SIGNALING_STATE_CHANGED = "signaling_state_changed",
19
+ GATHERING_STATE_CHANGED = "gathering_state_changed",
20
+ ICE_RESTART = "ice_restart",
21
+ ICE_CANDIDATES_CHANGED = "ice_candidates_changed",
22
+ ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed",
23
+ ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed",
17
24
  WEBSOCKET_CONNECTED = "websocket_connected",
18
25
  WEBSOCKET_RECONNECTED = "websocket_reconnected",
19
26
  WEBSOCKET_FAILED_PINGS = "websocket_failed_pings",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.13-dev.c9243c68.0",
3
+ "version": "2.8.13-dev.da97cd25.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",
@@ -638,5 +638,15 @@ declare namespace External {
638
638
  * Собеседник подключился к сигналлингу
639
639
  */
640
640
  function onPeerRegistered(conversationId?: string, externalIds?: ExternalId[]): void;
641
+ /**
642
+ * SDK обнаружил ошибку, после которой звонок может продолжаться.
643
+ *
644
+ * Callback предназначен для отправки ошибки в клиентский мониторинг.
645
+ * Его вызов не означает завершение звонка.
646
+ *
647
+ * @param error
648
+ * @param conversationId ID звонка
649
+ */
650
+ function onNonFatalError(error: Error, conversationId: string | null): void;
641
651
  }
642
652
  export default External;
@@ -37,6 +37,11 @@ export type ParamsObject = {
37
37
  platform: string;
38
38
  /** @hidden */
39
39
  clientStatsPlatform: string;
40
+ /**
41
+ * Версия приложения-хоста, уходит в статистику и сигналинг, например `'26.31.0:6822'`.
42
+ * По умолчанию `'0.0.0'`
43
+ */
44
+ appVersion: string;
40
45
  /** @hidden */
41
46
  clientType: string;
42
47
  /** @hidden */
@@ -269,6 +274,13 @@ export type ParamsObject = {
269
274
  perfStatReportEnabled: boolean;
270
275
  /** @hidden */
271
276
  callStatReportEnabled: boolean;
277
+ /**
278
+ * Отправлять событие статистики ice_candidate_gathering_failed
279
+ *
280
+ * _По умолчанию: `false`_
281
+ * @hidden
282
+ */
283
+ iceCandidateErrorStatEnabled: boolean;
272
284
  /**
273
285
  * Отдавать приоритет кодеку H264 для исходящего видео
274
286
  *
@@ -911,6 +923,13 @@ export type ParamsObject = {
911
923
  * Собеседник подключился к сигналлингу
912
924
  */
913
925
  onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
926
+ /**
927
+ * SDK обнаружил ошибку, после которой звонок может продолжаться.
928
+ *
929
+ * Callback предназначен для отправки ошибки в клиентский мониторинг.
930
+ * Его вызов не означает завершение звонка.
931
+ */
932
+ onNonFatalError?: (error: Error, conversationId: string | null) => void;
914
933
  };
915
934
  export default abstract class Params {
916
935
  private static _params;
@@ -920,7 +939,13 @@ export default abstract class Params {
920
939
  static getScreenFrameRate(fastScreenShare: boolean): number;
921
940
  static get<N extends keyof ParamsObject>(name: N): ParamsObject[N];
922
941
  static get appName(): string;
923
- static get appVersion(): number;
942
+ static get appVersion(): string;
943
+ /**
944
+ * Версия клиента для `client_version` в `auth.anonymLogin`. Бэкенд валидирует формат,
945
+ * поэтому это фиксированное значение, а не версия приложения-хоста (см. {@link Params.appVersion}).
946
+ * @hidden
947
+ */
948
+ static get apiClientVersion(): number;
924
949
  static get sdkVersion(): string;
925
950
  static get debug(): boolean;
926
951
  static get protocolVersion(): 5 | 6;
@@ -1005,6 +1030,7 @@ export default abstract class Params {
1005
1030
  static get networkStatisticsInterval(): number;
1006
1031
  static get perfStatReportEnabled(): boolean;
1007
1032
  static get callStatReportEnabled(): boolean;
1033
+ static get iceCandidateErrorStatEnabled(): boolean;
1008
1034
  static get enableLogPerfStatReport(): boolean;
1009
1035
  static get asrDataChannel(): boolean;
1010
1036
  static get consumerScreenDataChannelPacketSize(): number;
@@ -1076,10 +1102,12 @@ export default abstract class Params {
1076
1102
  videoSuspend: boolean;
1077
1103
  debugLog: boolean;
1078
1104
  callStatReportEnabled: boolean;
1105
+ iceCandidateErrorStatEnabled: boolean;
1079
1106
  joinFromMultipleDevices: boolean;
1080
1107
  movieShare: boolean;
1081
1108
  clientType: string;
1082
1109
  clientStatsPlatform: string;
1110
+ appVersion: string;
1083
1111
  consumerScreenDataChannelPacketSize: number;
1084
1112
  switchVideoAtBadNetwork: boolean;
1085
1113
  simulcast: boolean;