@vkontakte/calls-sdk 2.8.12 → 2.8.13-beta.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);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.12",
3
+ "version": "2.8.13-beta.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;
@@ -911,6 +911,13 @@ export type ParamsObject = {
911
911
  * Собеседник подключился к сигналлингу
912
912
  */
913
913
  onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
914
+ /**
915
+ * SDK обнаружил ошибку, после которой звонок может продолжаться.
916
+ *
917
+ * Callback предназначен для отправки ошибки в клиентский мониторинг.
918
+ * Его вызов не означает завершение звонка.
919
+ */
920
+ onNonFatalError?: (error: Error, conversationId: string | null) => void;
914
921
  };
915
922
  export default abstract class Params {
916
923
  private static _params;