@vkontakte/calls-sdk 2.8.13-beta.11 → 2.8.13-beta.12

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.
@@ -6,18 +6,31 @@ export interface HoldableConversation extends Conversation {
6
6
  }
7
7
  export declare class CallRegistry {
8
8
  private _conversations;
9
- private _reserved;
9
+ private _pending;
10
+ private _initialIds;
11
+ private _hangups;
10
12
  private _activeId;
13
+ private _selected;
11
14
  private _mutex;
12
15
  private _pendingRemovals;
13
- reserve(id: string): void;
16
+ addPending(conversation: HoldableConversation): void;
17
+ selectPending(conversation: HoldableConversation): HoldableConversation | null;
18
+ isSelected(conversation: HoldableConversation): boolean;
19
+ releaseSelection(conversation: HoldableConversation, previous?: HoldableConversation | null): void;
20
+ selectIfNone(conversation: HoldableConversation): void;
14
21
  add(conversation: HoldableConversation): void;
15
- remove(id: string | null): void;
22
+ remove(conversation: HoldableConversation): void;
16
23
  get(id: string): HoldableConversation | undefined;
24
+ getPending(id?: string): HoldableConversation | null;
25
+ isPending(conversation: HoldableConversation): boolean;
26
+ getLocal(id?: string): HoldableConversation | null;
27
+ trackHangup(conversation: HoldableConversation, promise: Promise<void>): void;
28
+ getHangup(id?: string): Promise<void> | undefined;
29
+ removeHangup(promise: Promise<void>): void;
17
30
  getActive(): HoldableConversation | null;
18
31
  getFirst(): HoldableConversation | null;
19
32
  getActiveId(): string | null;
20
- has(id: string): boolean;
33
+ has(id: string, except?: HoldableConversation): boolean;
21
34
  getAll(): HoldableConversation[];
22
35
  get callsLength(): number;
23
36
  setActive(id: string): Promise<void>;
@@ -39,6 +39,8 @@ export declare class MediaSource extends EventEmitter {
39
39
  private _screenTrack;
40
40
  private _audioShareTrack;
41
41
  private _screenShareTrack;
42
+ private _screenCaptureRequest;
43
+ private _destroyed;
42
44
  /** Трек для отправки в медиа-канал. Может отличаться при скриншаринге в дата-канал */
43
45
  private _sendVideoTrack;
44
46
  /** Трек с камеры. В стриме будет другой трек при включенных видео эффектах */
@@ -15,7 +15,7 @@ import { IAsrStartParams, IAsrStopParams } from '../../types/Asr';
15
15
  import { AudienceModeHandsResponse } from '../../types/AudienceMode';
16
16
  import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../../types/Conversation';
17
17
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../../types/ExternalId';
18
- import type { FastHangupHandler, HangupParams } from '../../types/FastHangup';
18
+ import type { HangupParams } from '../../types/FastHangup';
19
19
  import MediaModifiers from '../../types/MediaModifiers';
20
20
  import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
21
21
  import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
@@ -35,6 +35,9 @@ export default class Conversation extends EventEmitter {
35
35
  private readonly _signalingActor;
36
36
  private readonly _displayLayoutRequester;
37
37
  private _mediaSource;
38
+ private _requestingLocalMedia;
39
+ private _requestedLocalAudio?;
40
+ private _requestedLocalVideo?;
38
41
  private _conversation;
39
42
  private _myLastRequestedLayouts;
40
43
  private _state;
@@ -56,14 +59,17 @@ export default class Conversation extends EventEmitter {
56
59
  private _isRealTimeAsrRequested;
57
60
  private _serverSettings;
58
61
  private _serverTimeOffset;
59
- private _delayedHangup;
62
+ private _serverConversationId;
60
63
  private _onFastHangup?;
61
64
  private _hangupEmitted;
62
65
  private _hangupPromise;
66
+ private _hangupReason;
63
67
  private _abortController;
64
68
  private _registeredPeerReceived;
65
69
  private _calleeUnavailableTimer;
66
- private _reservedId;
70
+ private _pendingId;
71
+ private _resolveSignalingInitialization;
72
+ private readonly _signalingInitialization;
67
73
  private readonly _onUnload;
68
74
  private readonly _onRestore;
69
75
  private readonly _onVisibilityChange;
@@ -81,7 +87,6 @@ export default class Conversation extends EventEmitter {
81
87
  private readonly _statFirstMediaReceived;
82
88
  constructor(api: BaseApi, externalLogger: BaseLogger | null);
83
89
  static current(): Conversation | null;
84
- static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
85
90
  static id(): string | null;
86
91
  get id(): string;
87
92
  get externalId(): ExternalParticipantId | undefined;
@@ -117,6 +122,7 @@ export default class Conversation extends EventEmitter {
117
122
  accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
118
123
  decline(params?: HangupParams): Promise<void>;
119
124
  hangup(params?: HangupParams): Promise<void>;
125
+ private _waitForHangup;
120
126
  addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<ExternalParticipant[] | undefined>;
121
127
  addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
122
128
  removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
@@ -125,11 +131,15 @@ export default class Conversation extends EventEmitter {
125
131
  private _openTransport;
126
132
  private _allocateParticipantTransport;
127
133
  private _closeParticipantTransport;
134
+ private _registerPending;
128
135
  private _cleanupRegistry;
136
+ private _applyInitialActiveSelection;
129
137
  private _emitHangupOnce;
130
138
  private _sendHangupApi;
131
139
  private _close;
132
140
  private _sendHangup;
141
+ private _throwIfClosed;
142
+ private _applyServerConversation;
133
143
  destroy(): void;
134
144
  private _destroy;
135
145
  private _getConversationParams;
@@ -153,8 +163,10 @@ export default class Conversation extends EventEmitter {
153
163
  private _cacheParticipantExternalIds;
154
164
  private _setConversation;
155
165
  private _updateConversation;
166
+ private _requestLocalMedia;
156
167
  private _createMediaSource;
157
168
  private _connectSignaling;
169
+ private _completeSignalingInitialization;
158
170
  private _processConnection;
159
171
  private _onConversationParticipantListChunk;
160
172
  private _createParticipantListChunk;
@@ -466,8 +478,6 @@ export default class Conversation extends EventEmitter {
466
478
  private _registerParticipant;
467
479
  private _getParticipant;
468
480
  }
469
- declare function _resetPendingInstance(): void;
470
- export { _resetPendingInstance };
471
481
  export declare class UpdateDisplayLayoutError extends Error {
472
482
  readonly participantErrors: {
473
483
  externalId: ExternalParticipantId;
@@ -37,6 +37,7 @@ declare function createParams(): {
37
37
  onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
38
38
  onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
39
39
  onNonFatalError: Mock<import("@vitest/spy").Procedure>;
40
+ onSignalingConnected: Mock<import("@vitest/spy").Procedure>;
40
41
  };
41
42
  export type ConversationTestParams = ReturnType<typeof createParams>;
42
43
  export type ConversationTestTools = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.13-beta.11",
3
+ "version": "2.8.13-beta.12",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -635,6 +635,10 @@ declare namespace External {
635
635
  */
636
636
  function onParticipantIdChanged(prevId: ExternalParticipantId, newId: ExternalParticipantId, conversationId?: string): void;
637
637
  function onVideoSuspendSuggest(bandwidth: number, conversationId?: string): void;
638
+ /**
639
+ * Успешно применено первое подключение к сигналингу или переподключение.
640
+ */
641
+ function onSignalingConnected(conversationId: string): void;
638
642
  /**
639
643
  * Одобрено повышение пользователя в зеле ожидания/зале в режиме Audience
640
644
  *
@@ -562,7 +562,9 @@ export type ParamsObject = {
562
562
  */
563
563
  forwardEmptyIceCandidate: boolean;
564
564
  /**
565
- * Получен локальный стрим с камеры/микрофона
565
+ * Получен локальный стрим с камеры/микрофона, в том числе до подключения сигналинга.
566
+ * Повторяется после изменения видео (включение, выключение, смена камеры).
567
+ * Повторное событие может содержать тот же MediaStream с обновлёнными треками.
566
568
  */
567
569
  onLocalStream?: (stream: MediaStream | null, mediaSettings: MediaSettings, conversationId?: string) => void;
568
570
  /**
@@ -744,7 +746,8 @@ export type ParamsObject = {
744
746
  onLocalVolume?: (volume: number, isMicEnabled: boolean) => void;
745
747
  onJoinStatus?: (available: boolean, chatId: string, conversationId?: string) => void;
746
748
  /**
747
- * Звонок был завершен
749
+ * Звонок завершён локально. При hangup callback планируется сразу, ровно один раз, без ожидания сети.
750
+ * Доставляется асинхронно; Promise hangup отдельно ждёт известную SDK работу по завершению.
748
751
  */
749
752
  onHangup?: (type: HangupReason | Error, conversationId: string | null) => void;
750
753
  /**
@@ -933,6 +936,13 @@ export type ParamsObject = {
933
936
  * @param bandwidth текущая полоса пропускания, kbps
934
937
  */
935
938
  onVideoSuspendSuggest?: (bandwidth: number, conversationId?: string) => void;
939
+ /**
940
+ * Первое подключение к сигналингу или переподключение успешно применено к состоянию звонка.
941
+ * Звонок зарегистрирован под conversationId, локальное управление доступно, в том числе в зале ожидания.
942
+ * Событие не означает принятие звонка собеседником или готовность WebRTC.
943
+ * Callback вызывается асинхронно; к моменту вызова звонок может уже завершиться.
944
+ */
945
+ onSignalingConnected?: (conversationId: string) => void;
936
946
  /**
937
947
  * Одобрено повышение пользователя в зале ожидания/зале в режиме Audience
938
948
  *
@@ -34,13 +34,15 @@ export interface FastHangupResponse {
34
34
  *
35
35
  * `reason` и `conversationId` идут в signaling hangup.
36
36
  * `onFastHangup` заменяет Calls API `vchat.hangupConversation`, если обработчик передан
37
- * (явный hangup/decline или delayed hangup во время init).
38
- * Если обработчик не передан, API hangup не вызывается — кроме закрытия вкладки (`pagehide`),
39
- * где SDK всегда шлёт beacon, и delayed hangup без handler.
37
+ * (явный hangup/decline, включая отмену инициализации).
38
+ * При `hangup` без обработчика SDK отправляет Calls API beacon, если серверный ID уже известен.
39
+ * При `declineCall` без обработчика остаётся только signaling hangup.
40
+ * На закрытии вкладки (`pagehide`) SDK всегда использует beacon вместо обработчика.
40
41
  */
41
42
  export interface HangupParams {
42
43
  /**
43
- * ID звонка. Если опущен — завершается текущий активный звонок.
44
+ * Текущий или исходный ID для локального hangup; declineCall требует текущий ID готового звонка.
45
+ * Без ID: активный готовый, затем первый готовый, а для hangup — также единственный готовящийся звонок.
44
46
  */
45
47
  conversationId?: string;
46
48
  /**
@@ -61,6 +63,6 @@ export interface HangupParams {
61
63
  * На `pagehide` не используется — SDK всегда отправляет `sendBeacon`.
62
64
  *
63
65
  * @param params Параметры запроса
64
- * @param signal AbortSignal текущего звонка, если он ещё жив на момент вызова
66
+ * @param signal При `hangup` — отдельный AbortSignal завершения, при `declineCall` — сигнал текущего звонка, если он есть
65
67
  */
66
68
  export type FastHangupHandler = (params: FastHangupParams, signal?: AbortSignal) => Promise<FastHangupResponse>;