@vkontakte/calls-sdk 2.8.13-dev.ab19d582.0 → 2.8.13-dev.f163e503.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';
@@ -85,12 +85,18 @@ export default class Conversation extends EventEmitter {
85
85
  get externalId(): ExternalParticipantId | undefined;
86
86
  get mediaSettings(): MediaSettings | undefined;
87
87
  get isCallHeld(): boolean;
88
+ get isIncomingRinging(): boolean;
88
89
  static debugSessionId(): string | null;
89
90
  static debugMessage(type: DebugMessageType, ...args: any[]): boolean;
90
91
  static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
91
92
  static getSyncedTime(): number;
92
93
  get debugSessionId(): string | null;
93
- getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
94
+ getCachedParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
95
+ private _onNonFatalError;
96
+ /**
97
+ * Внешний id звонящего во входящем звонке, либо null, если звонящий не найден.
98
+ */
99
+ getIncomingCallerExternalId(): ExternalParticipantId | null;
94
100
  private _buildInternalParams;
95
101
  onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
96
102
  onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
@@ -164,8 +170,9 @@ export default class Conversation extends EventEmitter {
164
170
  private _registerParticipantInCache;
165
171
  private _getExistedParticipantByIdOrCreate;
166
172
  private _getExternalIdByParticipantId;
167
- private _getExternalIdsByOkIdsFromCache;
168
- private _getOrCacheExternalIdByCompositeId;
173
+ private _getExternalIdsByParticipantIds;
174
+ private _reportMissingExternalIds;
175
+ private _reportMissingExternalIdsById;
169
176
  private _registerParticipantAndSetMarkersIfChunkEnabled;
170
177
  private _warnParticipantNotInConversation;
171
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;
@@ -9,6 +9,7 @@ export default class StreamBuilder extends BaseStreamBuilder {
9
9
  private _decoderReady;
10
10
  private _decoderBusy;
11
11
  private _decoderQueue;
12
+ private _webCodecsRetryAttempted;
12
13
  private _fpsMeter;
13
14
  private readonly _logger;
14
15
  constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat, statAggregator: StatAggregator | null, onKeyFrameRequested: VoidFunction, debug?: DebugLogger, logger?: StatsLogger | null);
@@ -0,0 +1,38 @@
1
+ import { StatAggregator } from './StatAggregator';
2
+ type SdpDescription = {
3
+ type: RTCSdpType;
4
+ sdp?: string;
5
+ };
6
+ /**
7
+ * Отправляет в стату согласование SDP: что сгенерировали, что получили от собеседника
8
+ * и на какой операции сломались.
9
+ */
10
+ export declare class SdpStats {
11
+ private readonly _statAggregator;
12
+ private _pc;
13
+ private _gatheringStartedAt;
14
+ private _remoteSdpReceivedAt;
15
+ private readonly _handleGatheringStateChange;
16
+ constructor(statAggregator: StatAggregator | null);
17
+ /** Начинает следить за сбором кандидатов, предыдущее соединение перестает слушать */
18
+ observe(pc: RTCPeerConnection): void;
19
+ stop(): void;
20
+ /** Сгенерировали свой SDP */
21
+ logSdpGenerated(type: RTCSdpType): void;
22
+ /** Собрали свой ICE-кандидат */
23
+ logCandidateGenerated(candidate: RTCIceCandidate): void;
24
+ /** Получили SDP от собеседника */
25
+ logSdpReceived(type: RTCSdpType): void;
26
+ /** Получили ICE-кандидата от собеседника */
27
+ logCandidateReceived(candidate: RTCIceCandidateInit): void;
28
+ /** Не смогли сгенерировать SDP */
29
+ logCreateFailed(type: RTCSdpType, error: unknown): void;
30
+ /** Не смогли применить свой SDP */
31
+ logSetLocalFailed(sdp: SdpDescription, error: unknown): void;
32
+ /** Не смогли применить SDP собеседника */
33
+ logSetRemoteFailed(sdp: SdpDescription, error: unknown): void;
34
+ destroy(): void;
35
+ private _logFailure;
36
+ private _log;
37
+ }
38
+ export {};
@@ -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 _sdpStats;
42
43
  private readonly _debug;
43
44
  private readonly _logger;
44
45
  private readonly _statAggregator;
@@ -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 _sdpStats;
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,18 @@ 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
+ SDP_CREATE_OFFER = "sdp_create_offer",
18
+ SDP_CREATE_ANSWER = "sdp_create_answer",
19
+ SDP_SET_LOCAL_OFFER = "sdp_set_local_offer",
20
+ SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer",
21
+ SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer",
22
+ SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback",
23
+ SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer",
24
+ SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer",
25
+ SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer",
26
+ SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback",
27
+ SDP_GENERATED = "sdp_generated",
28
+ SDP_RECEIVED = "sdp_received",
17
29
  WEBSOCKET_CONNECTED = "websocket_connected",
18
30
  WEBSOCKET_RECONNECTED = "websocket_reconnected",
19
31
  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.ab19d582.0",
3
+ "version": "2.8.13-dev.f163e503.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 */
@@ -911,6 +916,13 @@ export type ParamsObject = {
911
916
  * Собеседник подключился к сигналлингу
912
917
  */
913
918
  onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
919
+ /**
920
+ * SDK обнаружил ошибку, после которой звонок может продолжаться.
921
+ *
922
+ * Callback предназначен для отправки ошибки в клиентский мониторинг.
923
+ * Его вызов не означает завершение звонка.
924
+ */
925
+ onNonFatalError?: (error: Error, conversationId: string | null) => void;
914
926
  };
915
927
  export default abstract class Params {
916
928
  private static _params;
@@ -920,7 +932,13 @@ export default abstract class Params {
920
932
  static getScreenFrameRate(fastScreenShare: boolean): number;
921
933
  static get<N extends keyof ParamsObject>(name: N): ParamsObject[N];
922
934
  static get appName(): string;
923
- static get appVersion(): number;
935
+ static get appVersion(): string;
936
+ /**
937
+ * Версия клиента для `client_version` в `auth.anonymLogin`. Бэкенд валидирует формат,
938
+ * поэтому это фиксированное значение, а не версия приложения-хоста (см. {@link Params.appVersion}).
939
+ * @hidden
940
+ */
941
+ static get apiClientVersion(): number;
924
942
  static get sdkVersion(): string;
925
943
  static get debug(): boolean;
926
944
  static get protocolVersion(): 5 | 6;
@@ -1080,6 +1098,7 @@ export default abstract class Params {
1080
1098
  movieShare: boolean;
1081
1099
  clientType: string;
1082
1100
  clientStatsPlatform: string;
1101
+ appVersion: string;
1083
1102
  consumerScreenDataChannelPacketSize: number;
1084
1103
  switchVideoAtBadNetwork: boolean;
1085
1104
  simulcast: boolean;