@vkontakte/calls-sdk 2.8.11-dev.3de63af6.0 → 2.8.11-dev.41bc9113.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,25 @@
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
+ getActiveId(): string | null;
16
+ has(id: string): boolean;
17
+ getAll(): HoldableConversation[];
18
+ get callsLength(): number;
19
+ setActive(id: string): Promise<void>;
20
+ setHold(id: string): Promise<void>;
21
+ switchCall(id: string): Promise<void>;
22
+ clear(): void;
23
+ }
24
+ declare const callRegistry: CallRegistry;
25
+ export { callRegistry };
@@ -16,11 +16,11 @@ 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';
23
- import { ParticipantLayout } from '../types/ParticipantLayout';
23
+ import { DisplayLayoutRequest, ParticipantLayout } from '../types/ParticipantLayout';
24
24
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
25
25
  import ParticipantPriority from '../types/ParticipantPriority';
26
26
  import { ParticipantStreamDescription } from '../types/ParticipantStreamDescription';
@@ -32,10 +32,12 @@ export default class Conversation extends EventEmitter {
32
32
  private readonly _api;
33
33
  private readonly _signaling;
34
34
  private readonly _signalingActor;
35
+ private readonly _displayLayoutRequester;
35
36
  private _mediaSource;
36
37
  private _conversation;
37
38
  private _myLastRequestedLayouts;
38
39
  private _state;
40
+ private _previousState;
39
41
  private _participantState;
40
42
  private _participants;
41
43
  private _pendingParticipants;
@@ -51,10 +53,8 @@ export default class Conversation extends EventEmitter {
51
53
  private _isRealTimeAsrRequested;
52
54
  private _serverSettings;
53
55
  private _serverTimeOffset;
54
- private static _current;
55
- private static _activationMutex;
56
- private static _delayedHangup;
57
- private static _abortController;
56
+ private _delayedHangup;
57
+ private _abortController;
58
58
  private readonly _onUnload;
59
59
  private readonly _audioOutput;
60
60
  private readonly _stats;
@@ -72,6 +72,10 @@ export default class Conversation extends EventEmitter {
72
72
  static current(): Conversation | null;
73
73
  static hangupAfterInit(): void;
74
74
  static id(): string | null;
75
+ get id(): string;
76
+ get externalId(): ExternalParticipantId | undefined;
77
+ get mediaSettings(): MediaSettings | undefined;
78
+ get isCallHeld(): boolean;
75
79
  static debugSessionId(): string | null;
76
80
  static getSyncedTime(): number;
77
81
  get debugSessionId(): string | null;
@@ -205,11 +209,12 @@ export default class Conversation extends EventEmitter {
205
209
  */
206
210
  changePriorities(priorities: ParticipantPriority[]): Promise<void>;
207
211
  changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<void>;
208
- hold(hold: boolean): Promise<void>;
212
+ hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
209
213
  putHandsDown(): Promise<void>;
210
214
  requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
211
215
  requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
212
216
  updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
217
+ requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
213
218
  feedback(key: string): Promise<SignalingMessage>;
214
219
  userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
215
220
  sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
@@ -285,7 +290,6 @@ export default class Conversation extends EventEmitter {
285
290
  startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null, roomId?: number | null): Promise<undefined>;
286
291
  stopStream(roomId?: number | null, remove?: boolean): Promise<undefined>;
287
292
  publishStream(roomId?: number | null): Promise<undefined>;
288
- recordSetConf(king?: ParticipantId, pawns?: ParticipantId[], hideParticipantCount?: boolean, roomId?: number | null): Promise<void>;
289
293
  getStreamInfo(): Promise<{
290
294
  movieId: any;
291
295
  preview: any;
@@ -350,6 +354,7 @@ export default class Conversation extends EventEmitter {
350
354
  private _onPinParticipant;
351
355
  private _onOptionsChanged;
352
356
  private _onNetworkStatus;
357
+ private _emitHeldParticipantsStatus;
353
358
  private _onRemoteStreamSecond;
354
359
  /**
355
360
  * Коллбек, вызывающийся при получении/остановке стрима от AnimojiReceiver
@@ -370,6 +375,7 @@ export default class Conversation extends EventEmitter {
370
375
  private _onSpeakerChanged;
371
376
  private _onTransportStateChanged;
372
377
  private _onTransportLocalStateChanged;
378
+ private _areTransportParticipantsOnHold;
373
379
  private _onRemoteTrackAdded;
374
380
  private _onRemoteTrackRemoved;
375
381
  private _removeAudioTrack;
@@ -399,6 +405,7 @@ export default class Conversation extends EventEmitter {
399
405
  private _onFeedback;
400
406
  private _onDecorativeParticipantIdChanged;
401
407
  private _onVideoSuspendSuggest;
408
+ private _onParticipantHold;
402
409
  private _isMe;
403
410
  private _getMuteStatesForRoomId;
404
411
  private _getMuteStatesForCurrentRoom;
@@ -408,6 +415,8 @@ export default class Conversation extends EventEmitter {
408
415
  private _getParticipants;
409
416
  private _getParticipant;
410
417
  }
418
+ declare function _resetPendingInstance(): void;
419
+ export { _resetPendingInstance };
411
420
  export declare class UpdateDisplayLayoutError extends Error {
412
421
  readonly participantErrors: {
413
422
  externalId: ExternalParticipantId;
@@ -0,0 +1,39 @@
1
+ import BaseApi from '../abstract/BaseApi';
2
+ import type { DebugLogger } from '../static/Debug';
3
+ import { DisplayLayoutRequest, ParticipantLayout } from '../types/ParticipantLayout';
4
+ import { Participant, ParticipantId } from '../types/Participant';
5
+ type DisplayLayoutRequesterParams = {
6
+ api: BaseApi;
7
+ debug: DebugLogger;
8
+ getParticipants: () => Promise<Record<ParticipantId, Participant>>;
9
+ isMe: (participantId: ParticipantId) => boolean;
10
+ updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
11
+ };
12
+ export default class DisplayLayoutRequester {
13
+ private readonly _api;
14
+ private readonly _debug;
15
+ private readonly _getParticipants;
16
+ private readonly _isMe;
17
+ private readonly _updateDisplayLayout;
18
+ private _requestedLayouts;
19
+ private _uncertainLayouts;
20
+ private _pendingRequests;
21
+ private _pendingPromises;
22
+ private _lastRequests;
23
+ private _timer;
24
+ private _inFlight;
25
+ private _lastFlushAt;
26
+ private _generation;
27
+ private _forceNextFlush;
28
+ constructor({ api, debug, getParticipants, isMe, updateDisplayLayout }: DisplayLayoutRequesterParams);
29
+ request(requests: DisplayLayoutRequest[]): Promise<void>;
30
+ resend(): void;
31
+ cleanupParticipant(participantId: ParticipantId): void;
32
+ clear(): void;
33
+ private _schedule;
34
+ private _flush;
35
+ private _getRequestLayouts;
36
+ private _getDiff;
37
+ private _isChanged;
38
+ }
39
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
2
+ import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
3
+ export declare class ExternalIdCache {
4
+ private _okIdToExternalId;
5
+ private _externalIdToOkId;
6
+ private _decorativeIdToInitialId;
7
+ private _initialIdToDecorativeId;
8
+ getOkId(externalId: ExternalId): OkUserId | null;
9
+ getExternalId(okId: OkUserId): ExternalParticipantId | null;
10
+ hasByExternalId(externalId: ExternalId): boolean;
11
+ hasByOkId(okId: OkUserId): boolean;
12
+ cache(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
13
+ mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
14
+ unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
15
+ getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
16
+ replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
17
+ getParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
18
+ clear(): void;
19
+ }
@@ -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
  }
package/default/Api.d.ts CHANGED
@@ -8,9 +8,7 @@ import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
8
8
  export default class Api extends BaseApi {
9
9
  private _userId;
10
10
  private _uuid;
11
- private _externalUidsCache;
12
- private _decorativeIdToInitialId;
13
- private _initialIdToDecorativeId;
11
+ private _idCache;
14
12
  private _callUnsafe;
15
13
  protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
16
14
  userId(participantId: ParticipantId): Promise<ExternalParticipantId>;
@@ -25,7 +23,7 @@ export default class Api extends BaseApi {
25
23
  audioOnly?: boolean;
26
24
  waitForAdmin?: boolean;
27
25
  closedConversation?: boolean;
28
- }, speakerIds?: OkUserId[]): Promise<ConversationResponse>;
26
+ }, externalIds?: ExternalId[]): Promise<ConversationResponse>;
29
27
  startConversation(conversationId: string, ids?: OkUserId[], type?: CallType, isVideo?: boolean, payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie, waitForAdmin }?: {
30
28
  onlyAdminCanShareMovie?: boolean;
31
29
  waitForAdmin?: boolean;
@@ -42,19 +40,13 @@ export default class Api extends BaseApi {
42
40
  }>;
43
41
  getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
44
42
  joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
45
- /**
46
- * NB: Не сохраняет порядок возвращаемых ID
47
- * Этот метод принимает именно ExternalId, т.к. для OkUserId не принципиально наличие deviceIdx
48
- * @hidden
49
- */
50
- getOkIdsByExternalIds(externalIds: ExternalId[]): Promise<OkUserId[]>;
51
- getParticipantIdsByExternalIds(externalIds: ExternalId[]): Promise<Map<ExternalId, ParticipantId>>;
52
43
  /**
53
44
  * NB: Не сохраняет порядок возвращаемых ID
54
45
  * @hidden
55
46
  */
56
47
  getExternalIdsByOkIds(uids: OkUserId[]): Promise<ExternalParticipantId[]>;
57
48
  getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
49
+ getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
58
50
  cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
59
51
  mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
60
52
  unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
@@ -27,7 +27,7 @@ import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
27
27
  import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
28
28
  import { PerfStatReport } from '../types/PerfStatReporter';
29
29
  import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
30
- import { IPublishStreamData, IRecordConfData, IStartStreamData, IStopStreamData } from '../types/Streams';
30
+ import { IPublishStreamData, IStartStreamData, IStopStreamData } from '../types/Streams';
31
31
  export default class Signaling extends BaseSignaling {
32
32
  private socket;
33
33
  protected sequence: number;
@@ -130,7 +130,6 @@ export default class Signaling extends BaseSignaling {
130
130
  startStream(data: IStartStreamData): Promise<SignalingMessage>;
131
131
  stopStream(data?: IStopStreamData): Promise<SignalingMessage>;
132
132
  publishStream(data?: IPublishStreamData): Promise<SignalingMessage>;
133
- recordSetConf(conf?: IRecordConfData): Promise<SignalingMessage>;
134
133
  getRecordStatus(): Promise<SignalingMessage>;
135
134
  switchTopology(topology: TransportTopology, force?: boolean): Promise<SignalingMessage>;
136
135
  requestRealloc(): Promise<SignalingMessage>;
@@ -50,6 +50,7 @@ declare enum SignalingNotification {
50
50
  ASR_STARTED = "asr-started",
51
51
  ASR_STOPPED = "asr-stopped",
52
52
  DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed",
53
- VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest"
53
+ VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest",
54
+ HOLD = "hold"
54
55
  }
55
56
  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.3de63af6.0",
3
+ "version": "2.8.11-dev.41bc9113.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",
@@ -0,0 +1,5 @@
1
+ import { TCapabilities } from '../types/Capabilities';
2
+ declare namespace Capabilities {
3
+ function get(): TCapabilities;
4
+ }
5
+ export default Capabilities;