@vkontakte/calls-sdk 2.8.11-dev.6637565d.0 → 2.8.11-dev.67f8ff62.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.
@@ -0,0 +1,26 @@
1
+ import Conversation from './Conversation';
2
+ import MediaSettings from '../types/MediaSettings';
3
+ export interface HoldableConversation extends Conversation {
4
+ id: string;
5
+ hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
6
+ }
7
+ export declare class CallRegistry {
8
+ private _conversations;
9
+ private _activeId;
10
+ private _mutex;
11
+ add(conversation: HoldableConversation): void;
12
+ remove(id: string | null): void;
13
+ get(id: string): HoldableConversation | undefined;
14
+ getActive(): HoldableConversation | null;
15
+ getFirst(): HoldableConversation | null;
16
+ getActiveId(): string | null;
17
+ has(id: string): boolean;
18
+ getAll(): HoldableConversation[];
19
+ get callsLength(): number;
20
+ setActive(id: string): Promise<void>;
21
+ setHold(id: string): Promise<void>;
22
+ switchCall(id: string): Promise<void>;
23
+ clear(): void;
24
+ }
25
+ declare const callRegistry: CallRegistry;
26
+ export { callRegistry };
@@ -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 { IVideoDimentions } from '../types/MediaSettings';
19
+ import MediaSettings, { 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,6 +37,9 @@ export default class Conversation extends EventEmitter {
37
37
  private _conversation;
38
38
  private _myLastRequestedLayouts;
39
39
  private _state;
40
+ private _previousState;
41
+ /** Если пользователь в зале ожидания, холд должен вызываться после промоута */
42
+ private _waitingHallHoldPending;
40
43
  private _participantState;
41
44
  private _participants;
42
45
  private _pendingParticipants;
@@ -52,10 +55,10 @@ export default class Conversation extends EventEmitter {
52
55
  private _isRealTimeAsrRequested;
53
56
  private _serverSettings;
54
57
  private _serverTimeOffset;
55
- private static _current;
56
- private static _activationMutex;
57
- private static _delayedHangup;
58
- private static _abortController;
58
+ private _delayedHangup;
59
+ private _abortController;
60
+ private _registeredPeerReceived;
61
+ private _calleeUnavailableTimer;
59
62
  private readonly _onUnload;
60
63
  private readonly _audioOutput;
61
64
  private readonly _stats;
@@ -73,6 +76,10 @@ export default class Conversation extends EventEmitter {
73
76
  static current(): Conversation | null;
74
77
  static hangupAfterInit(): void;
75
78
  static id(): string | null;
79
+ get id(): string;
80
+ get externalId(): ExternalParticipantId | undefined;
81
+ get mediaSettings(): MediaSettings | undefined;
82
+ get isCallHeld(): boolean;
76
83
  static debugSessionId(): string | null;
77
84
  static getSyncedTime(): number;
78
85
  get debugSessionId(): string | null;
@@ -113,6 +120,7 @@ export default class Conversation extends EventEmitter {
113
120
  private _getConversationParams;
114
121
  private _setConversationParams;
115
122
  private _buildSignalingEndpoint;
123
+ private _clearCalleeUnavailableWatchdog;
116
124
  /**
117
125
  * @throws ErrorEvent
118
126
  */
@@ -127,7 +135,6 @@ export default class Conversation extends EventEmitter {
127
135
  private _prepareConversation;
128
136
  private _createParticipant;
129
137
  private _getParticipantId;
130
- private _cacheParticipantExternalIds;
131
138
  private _setConversation;
132
139
  private _updateConversation;
133
140
  private _createMediaSource;
@@ -140,11 +147,15 @@ export default class Conversation extends EventEmitter {
140
147
  private _registerParticipants;
141
148
  /** Установим состояние локальных мьютов */
142
149
  private _registerParticipantLocalMuteState;
143
- private _getStatusByTransportState;
150
+ private _remoteParticipantSessionState;
151
+ private _buildConnectionStatus;
152
+ private _isParticipantSessionStateApplicable;
153
+ private _setTransportStatus;
154
+ private _setSessionState;
155
+ private _emitParticipantTransition;
144
156
  private _registerParticipantInCache;
145
157
  private _getExistedParticipantByIdOrCreate;
146
158
  private _getExternalIdByParticipantId;
147
- private _getExternalIdsByOkIdsFromCache;
148
159
  private _registerParticipantAndSetMarkersIfChunkEnabled;
149
160
  private _warnParticipantNotInConversation;
150
161
  private _denormalizeMarkers;
@@ -181,6 +192,7 @@ export default class Conversation extends EventEmitter {
181
192
  private _cleanupParticipants;
182
193
  private _cleanupParticipantAgnosticStreams;
183
194
  private _cleanupTransport;
195
+ private _cleanupTransportForHold;
184
196
  private _cleanupSpeakerDetector;
185
197
  private _cleanupSpecListener;
186
198
  private _cleanupSignaling;
@@ -208,15 +220,18 @@ export default class Conversation extends EventEmitter {
208
220
  */
209
221
  changePriorities(priorities: ParticipantPriority[]): Promise<void>;
210
222
  changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<void>;
211
- hold(hold: boolean): Promise<void>;
223
+ hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
224
+ private _holdLocally;
225
+ private _resumeLocalMedia;
226
+ private _restoreStateAfterHold;
227
+ private _isWaitingForPromotion;
228
+ private _getWaitingForPromotionStatus;
212
229
  putHandsDown(): Promise<void>;
213
230
  requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
214
231
  requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
215
232
  updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
216
233
  requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
217
234
  feedback(key: string): Promise<SignalingMessage>;
218
- userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
219
- sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
220
235
  private _changeMediaSettings;
221
236
  private _stopStreaming;
222
237
  /**
@@ -312,11 +327,17 @@ export default class Conversation extends EventEmitter {
312
327
  private _changeMultipleParticipantState;
313
328
  private _invokeRolesChangedCallbackIfNeeded;
314
329
  private _onSignalingNotification;
330
+ private _onSignalingTopologyChanged;
315
331
  private _onPromotionApproved;
316
332
  private _onSignalingReconnect;
317
333
  private _onSignalingFailed;
318
334
  private _onAcceptedCall;
319
335
  private _onHungup;
336
+ private _onSessionState;
337
+ private _reconcileParticipantSessionStates;
338
+ private _updateParticipantExternalId;
339
+ private _updateParticipantSessionState;
340
+ private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
320
341
  private _onAddedParticipant;
321
342
  private _onJoinedParticipant;
322
343
  private _onClosedConversation;
@@ -353,6 +374,7 @@ export default class Conversation extends EventEmitter {
353
374
  private _onPinParticipant;
354
375
  private _onOptionsChanged;
355
376
  private _onNetworkStatus;
377
+ private _emitHeldParticipantsStatus;
356
378
  private _onRemoteStreamSecond;
357
379
  /**
358
380
  * Коллбек, вызывающийся при получении/остановке стрима от AnimojiReceiver
@@ -373,6 +395,7 @@ export default class Conversation extends EventEmitter {
373
395
  private _onSpeakerChanged;
374
396
  private _onTransportStateChanged;
375
397
  private _onTransportLocalStateChanged;
398
+ private _areTransportParticipantsOnHold;
376
399
  private _onRemoteTrackAdded;
377
400
  private _onRemoteTrackRemoved;
378
401
  private _removeAudioTrack;
@@ -402,6 +425,7 @@ export default class Conversation extends EventEmitter {
402
425
  private _onFeedback;
403
426
  private _onDecorativeParticipantIdChanged;
404
427
  private _onVideoSuspendSuggest;
428
+ private _onParticipantHold;
405
429
  private _isMe;
406
430
  private _getMuteStatesForRoomId;
407
431
  private _getMuteStatesForCurrentRoom;
@@ -411,6 +435,8 @@ export default class Conversation extends EventEmitter {
411
435
  private _getParticipants;
412
436
  private _getParticipant;
413
437
  }
438
+ declare function _resetPendingInstance(): void;
439
+ export { _resetPendingInstance };
414
440
  export declare class UpdateDisplayLayoutError extends Error {
415
441
  readonly participantErrors: {
416
442
  externalId: ExternalParticipantId;
@@ -47,6 +47,7 @@ export declare class MediaSource extends EventEmitter {
47
47
  /** Трек аудио эффектов. Не изменяется на протяжении всего времени */
48
48
  private _audioEffectsTrack;
49
49
  private _mediaSettings;
50
+ private _lastMediaSettings;
50
51
  private _videoStatusOnScreenCapturingEnabled;
51
52
  private _effect;
52
53
  private _audioEffectParams;
@@ -67,7 +68,11 @@ export declare class MediaSource extends EventEmitter {
67
68
  getSendAudioTrack(): MediaStreamTrack | null;
68
69
  get isAnimojiRequested(): boolean;
69
70
  addTrackToPeerConnection(pc: RTCPeerConnection, observer: boolean, noDataChannel: boolean): void;
71
+ /**
72
+ * @deprecated Используйте гетер mediaSettings
73
+ */
70
74
  getMediaSettings(): MediaSettings;
75
+ get mediaSettings(): MediaSettings;
71
76
  changeDevice(kind: MediaDeviceKind): Promise<void>;
72
77
  /**
73
78
  * Установка кастомного стрима для видео, например внешний шаринг экрана
@@ -95,6 +100,8 @@ export declare class MediaSource extends EventEmitter {
95
100
  private _setEffect;
96
101
  private _stopEffect;
97
102
  destroy(): void;
103
+ stopLocalMedia(): Promise<void>;
104
+ resumeLocalMedia(lastActiveMediaSettings?: MediaSettings): Promise<void>;
98
105
  toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
99
106
  disableScreenCapturing(): Promise<void>;
100
107
  private videoTrackMuteHandler;
@@ -12,12 +12,17 @@ export default class SpecListener extends EventEmitter {
12
12
  private readonly _debug;
13
13
  private readonly _logger;
14
14
  private _connectionTimeout;
15
+ private _connectionTimeoutSuppressed;
15
16
  private _volumeTimeout;
16
17
  constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?: StatsLogger | null);
17
18
  destroy(): void;
18
19
  onChangeRemoteMediaSettings(participantId: ParticipantId, mediaSettings: MediaSettings): void;
20
+ onParticipantHoldChanged(): void;
21
+ private _getConnectionTimeout;
22
+ private _getVolumeTimeout;
19
23
  private _onTransportStateChanged;
20
24
  private _onVolumesDetected;
21
25
  private _onConnectionTimeout;
26
+ private _reportConnectionTimeout;
22
27
  private _onVolumeTimeout;
23
28
  }
@@ -10,20 +10,17 @@ export default class StatsLogger extends BaseLogger {
10
10
  private readonly _conversationIdProvider;
11
11
  private readonly _batchInterval;
12
12
  private _batchedClientStats;
13
- private _batchedClientEvents;
14
13
  private _batchTimeout;
15
14
  private _serverTimeDelta;
16
15
  constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null);
17
16
  log(name: StatLog, value?: string, immediately?: boolean): void;
18
17
  logClientStats(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
19
- logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
20
18
  destroy(): void;
21
19
  private _getConversationId;
22
20
  private _sendBatch;
23
21
  private _startTimeout;
24
22
  private _stopTimeout;
25
23
  private _sendClientStats;
26
- private _sendClientEvents;
27
24
  private _calculateServerTimeDelta;
28
25
  private _now;
29
26
  }
@@ -27,6 +27,7 @@ export default class DirectTransport extends BaseTransport {
27
27
  private _iceRestartTimeout;
28
28
  private _reconnectionTimeout;
29
29
  private _reconnectionPrevented;
30
+ private _remoteHold;
30
31
  private _lastStat;
31
32
  private _fingerprint;
32
33
  private _neverConnected;
@@ -50,6 +51,8 @@ export default class DirectTransport extends BaseTransport {
50
51
  updateSettings(settings: ServerSettings): void;
51
52
  preventRestart(): void;
52
53
  allowRestart(): void;
54
+ setRemoteHold(hold: boolean): void;
55
+ private _recreatePeerConnection;
53
56
  setAnimojiTransport(receiver: AnimojiReceiver, sender: AnimojiSender): void;
54
57
  close(error?: Error): void;
55
58
  private _setState;
@@ -55,6 +55,8 @@ export declare class Transport extends EventEmitter {
55
55
  open(participantIds: ParticipantId[], peerId?: string | null, observer?: boolean, force?: boolean): void;
56
56
  close(participantId: ParticipantId): void;
57
57
  destroy(): void;
58
+ holdClose(): void;
59
+ setRemoteHold(hold: boolean): void;
58
60
  getTopology(): TransportTopology;
59
61
  isAllocated(participantId: ParticipantId): boolean;
60
62
  allocated(): string[];
package/default/Api.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import BaseApi, { ClientEvent, ClientStats } from '../abstract/BaseApi';
1
+ import BaseApi, { ClientStats } from '../abstract/BaseApi';
2
2
  import CallType from '../enums/CallType';
3
3
  import HangupType from '../enums/HangupType';
4
4
  import ConversationParams from '../types/ConversationParams';
5
5
  import ConversationResponse from '../types/ConversationResponse';
6
6
  import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
7
7
  import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
8
+ import PushData from '../types/PushData';
8
9
  export default class Api extends BaseApi {
9
10
  private _userId;
10
11
  private _uuid;
@@ -19,7 +20,6 @@ export default class Api extends BaseApi {
19
20
  private _removeCachedAnonymLogin;
20
21
  private _applyAnonymLogin;
21
22
  logClientStats(items: ClientStats[]): void;
22
- logClientEvents(items: ClientEvent[]): void;
23
23
  uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
24
24
  joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
25
25
  createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie, audienceMode, audioOnly, waitForAdmin, closedConversation, }?: {
@@ -45,9 +45,13 @@ export default class Api extends BaseApi {
45
45
  }>;
46
46
  getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
47
47
  joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
48
+ /**
49
+ * NB: Не сохраняет порядок возвращаемых ID
50
+ * @hidden
51
+ */
52
+ getExternalIdsByOkIds(uids: OkUserId[]): Promise<ExternalParticipantId[]>;
48
53
  getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
49
54
  getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
50
- getCachedExternalIdByOkId(okId: OkUserId): ExternalParticipantId | null;
51
55
  cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
52
56
  mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
53
57
  unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
@@ -59,5 +63,7 @@ export default class Api extends BaseApi {
59
63
  hangupConversation(conversationId: string, reason?: HangupType): void;
60
64
  removeHistoryRecords(recordIds: number[]): Promise<void>;
61
65
  cleanup(): void;
66
+ private _getExternalIdsByOkIds;
62
67
  getServerTime(): Promise<number>;
68
+ getInbounds(): Promise<PushData[]>;
63
69
  }
@@ -16,6 +16,7 @@ declare enum HangupType {
16
16
  CALLER_IS_BLOCKED = "CALLER_IS_BLOCKED",
17
17
  NOT_FRIENDS = "NOT_FRIENDS",
18
18
  CALLEE_IS_OFFLINE = "CALLEE_IS_OFFLINE",
19
+ CALLEE_UNAVAILABLE = "CALLEE_UNAVAILABLE",
19
20
  CALLER_IS_REJECTED = "CALLER_IS_REJECTED",
20
21
  UNKNOWN_ERROR = "UNKNOWN_ERROR",
21
22
  UNSUPPORTED = "UNSUPPORTED",
@@ -24,6 +24,7 @@ declare enum SignalingNotification {
24
24
  REALLOC_CON = "realloc-con",
25
25
  AUDIO_ACTIVITY = "audio-activity",
26
26
  SPEAKER_CHANGED = "speaker-changed",
27
+ SESSION_STATE = "session-state",
27
28
  STALLED_ACTIVITY = "stalled-activity",
28
29
  CHAT_MESSAGE = "chat-message",
29
30
  CUSTOM_DATA = "custom-data",
@@ -50,6 +51,7 @@ declare enum SignalingNotification {
50
51
  ASR_STARTED = "asr-started",
51
52
  ASR_STOPPED = "asr-stopped",
52
53
  DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed",
53
- VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest"
54
+ VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest",
55
+ HOLD = "hold"
54
56
  }
55
57
  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.6637565d.0",
3
+ "version": "2.8.11-dev.67f8ff62.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",