@vkontakte/calls-sdk 2.8.12-dev.dfea6e89.0 → 2.8.12-dev.e2067192.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.
Files changed (45) hide show
  1. package/CallsSDK.d.ts +27 -4
  2. package/abstract/BaseApi.d.ts +2 -1
  3. package/abstract/BaseSignaling.d.ts +5 -1
  4. package/calls-sdk.cjs.js +7 -13
  5. package/calls-sdk.esm.js +2792 -2536
  6. package/classes/AudioOutput.d.ts +4 -1
  7. package/classes/CallRegistry.d.ts +1 -1
  8. package/classes/MediaSource.d.ts +4 -0
  9. package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +42 -33
  10. package/classes/conversation/Conversation.testUtils.d.ts +148 -0
  11. package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
  12. package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +4 -4
  13. package/classes/conversation/index.d.ts +1 -0
  14. package/classes/stat/CallLifecycleStats.d.ts +0 -4
  15. package/classes/stat/StatAggregator.d.ts +4 -0
  16. package/classes/transport/DirectTransport.d.ts +1 -0
  17. package/classes/transport/PerfStatReporter.d.ts +2 -0
  18. package/classes/transport/ServerTransport.d.ts +1 -4
  19. package/classes/transport/SimulcastSender.d.ts +31 -0
  20. package/classes/transport/Transport.d.ts +3 -0
  21. package/default/Api.d.ts +4 -1
  22. package/default/ApiExternal.d.ts +2 -1
  23. package/default/Signaling.d.ts +4 -1
  24. package/default/SignalingTransport.d.ts +6 -1
  25. package/enums/ClientHangupReason.d.ts +7 -0
  26. package/enums/Stat.d.ts +0 -1
  27. package/package.json +3 -3
  28. package/static/ApiTransport.d.ts +3 -0
  29. package/static/Params.d.ts +27 -1
  30. package/static/ParticipantConnectionStatusUtils.d.ts +1 -0
  31. package/static/Sdp.d.ts +3 -0
  32. package/static/SignalingCapabilities.d.ts +1 -1
  33. package/static/SimulcastInfo.d.ts +5 -3
  34. package/static/Utils.d.ts +1 -2
  35. package/static/WebRTCUtils.d.ts +4 -7
  36. package/types/Api.d.ts +9 -0
  37. package/types/Capabilities.d.ts +1 -0
  38. package/types/FastHangup.d.ts +66 -0
  39. package/types/Participant.d.ts +1 -0
  40. package/types/PerfStatReporter.d.ts +0 -4
  41. package/types/SignalingCommand.d.ts +2 -0
  42. package/types/SignalingMessage.d.ts +1 -0
  43. package/utils/IceServers.d.ts +2 -0
  44. package/utils/NavigatorPermissions.d.ts +2 -2
  45. package/utils/SerializeLatest.d.ts +5 -0
package/CallsSDK.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * CallsSDK
3
3
  */
4
4
  import type { IEffect, VideoEffects } from '@vkontakte/calls-video-effects';
5
- import type { EffectVoiceChange } from '@vkontakte/calls-audio-effects';
5
+ import type { EffectVoiceChange, VadControllerOptions, VadLib } from '@vkontakte/calls-audio-effects';
6
6
  import type * as Vmoji from '@vkontakte/calls-vmoji';
7
7
  import BaseLogger from './abstract/BaseLogger';
8
8
  import { AddParticipantParams } from './abstract/BaseSignaling';
@@ -14,6 +14,7 @@ import Api from './default/Api';
14
14
  import Signaling from './default/Signaling';
15
15
  import CallDirection from './enums/CallDirection';
16
16
  import CallType from './enums/CallType';
17
+ import type ClientHangupReason from './enums/ClientHangupReason';
17
18
  import ChatRoomEventType from './enums/ChatRoomEventType';
18
19
  import ConversationFeature from './enums/ConversationFeature';
19
20
  import ConversationOption from './enums/ConversationOption';
@@ -67,6 +68,7 @@ import { VmojiError } from './types/Vmoji';
67
68
  import { VolumeDetector } from './classes/VolumeDetector';
68
69
  import { FastStartHandler, FastStartParams } from './types/FastStart';
69
70
  import { FastJoinHandler, FastJoinParams, FastJoinResponse } from './types/FastJoin';
71
+ import { FastHangupHandler, FastHangupParams, FastHangupResponse, HangupParams } from './types/FastHangup';
70
72
  import PushData from './types/PushData';
71
73
  export type { CurrentLogItem, DebugLogGetParams, DebugLogSessionInfo, DebugLogStorageStats } from './utils/DebugStorage';
72
74
  /**
@@ -212,6 +214,13 @@ export declare function setVideoEffects(effects: VideoEffects): void;
212
214
  * @param effects Экземпляр класса `EffectVoiceChange` из `@vkontakte/calls-audio-effects`
213
215
  */
214
216
  export declare function setAudioEffects(effects: EffectVoiceChange): void;
217
+ /**
218
+ * Устанавливает поддержку VAD
219
+ *
220
+ * @param vad принимает VadController из `@vkontakte/calls-audio-effects`
221
+ * @param options принимает VadControllerOptions из `@vkontakte/calls-audio-effects`
222
+ */
223
+ export declare function setVad(vad: VadLib, options?: VadControllerOptions): void;
215
224
  /**
216
225
  * Устанавливает библиотеку вимоджи
217
226
  *
@@ -272,8 +281,14 @@ export declare function authorize(authToken?: string, apiBaseUrl?: IAPIBaseUrl):
272
281
  export declare function acceptCall(mediaOptions?: MediaOption[], conversationId?: string): Promise<ConversationData>;
273
282
  /**
274
283
  * Отклонить входящий звонок
284
+ *
285
+ * @param params Параметры завершения. `params.conversationId` — ID звонка
286
+ * (по умолчанию текущий активный), `params.reason` — причина завершения
287
+ * для проброса в сигналинг (по умолчанию `REJECTED`). См. {@link ClientHangupReason}.
288
+ * `params.onFastHangup` — опционально: вместо Calls API hangup при отклонении.
289
+ * На закрытии вкладки не используется. См. {@link HangupParams}.
275
290
  */
276
- export declare function declineCall(conversationId?: string): Promise<void>;
291
+ export declare function declineCall(params?: HangupParams): Promise<void>;
277
292
  /**
278
293
  * Присоединиться к активному звонку
279
294
  *
@@ -295,8 +310,16 @@ export declare function joinCallInternal(conversationId: string, mediaOptions: M
295
310
  export declare function joinCallByLink(joinLink: string, mediaOptions?: MediaOption[], anonymToken?: string, observedIds?: ExternalUserId[], payload?: string, onFastJoin?: FastJoinHandler): Promise<ConversationData>;
296
311
  /**
297
312
  * Завершить текущий разговор
313
+ *
314
+ * @param params Параметры завершения. `params.conversationId` — ID звонка
315
+ * (по умолчанию текущий активный), `params.reason` — причина завершения
316
+ * для проброса в сигналинг: по умолчанию `HUNGUP` (если звонок активен) или `CANCELED`.
317
+ * См. {@link ClientHangupReason}.
318
+ * `params.onFastHangup` — опционально: вместо Calls API hangup, если обработчик передан.
319
+ * Без него API hangup не вызывается (signaling hangup остаётся). На `pagehide` всегда beacon.
320
+ * См. {@link HangupParams}.
298
321
  */
299
- export declare function hangup(conversationId?: string): Promise<void>;
322
+ export declare function hangup(params?: HangupParams): Promise<void>;
300
323
  /**
301
324
  * Добавить собеседника в звонок
302
325
  *
@@ -781,5 +804,5 @@ export declare function getSyncedTime(): number;
781
804
  * Версия SDK
782
805
  */
783
806
  export declare function version(): string;
784
- export type { AddParticipantParams, AudienceModeHandsResponse, BrowserName, CompositeUserId, ConversationData, ConversationParams, ConversationResponse, CustomError, ExternalId, ExternalParticipant, ExternalParticipantListChunk, ExternalParticipantListMarker, ExternalParticipantListMarkers as ExternalParticipantMarkers, ExternalParticipantId, DisplayLayoutRequest, GetParticipantsSignalingResponse, GetRoomsSignalingResponse, HangupReasonData, IApiEnv, IAPIBaseUrl, IAsrStartParams, IAsrStopParams, IAsrData, IceServer, JSONArray, JSONObject, JSONType, Layout, MediaModifiers, MediaSettings, MuteStates, OkUserId, ParamsObject, ParticipantId, ParticipantLayout, ParticipantListMarkers, ParticipantListType, ParticipantPriority, ParticipantsStateList, ParticipantStateData, ParticipantStateDataKey, ParticipantStateMapped, ParticipantStreamDescription, ParticipantListChunkParameters, ParticipantListMarker, RequestKeyFrame, Rooms, IGetParticipantsParameters, ScreenCaptureSettings, SignalingMessage, StatResult, StopStream, WaitingHallResponse, IMovieMetaData, IVideoDimentions, IFeedbackExternal, ISharedMovieInfo, ISharedMovieStoppedInfo, ISharedMovieState, ISharedMovieStateResponse, IAddMovieParams, IOnRemoteMovieData, IMoviePreview, IRoomId, Room, RoomsUpdate, RoomParticipantUpdate, IUpdateMovieData, IFeaturesPerRole, IMuteParticipantParams, IMuteParticipantInternalParams, IStartStreamData, IStopStreamData, IPublishStreamData, VmojiError, FastStartHandler, FastStartParams, FastJoinHandler, FastJoinParams, FastJoinResponse, };
807
+ export type { AddParticipantParams, AudienceModeHandsResponse, BrowserName, ClientHangupReason, CompositeUserId, ConversationData, ConversationParams, ConversationResponse, CustomError, ExternalId, ExternalParticipant, ExternalParticipantListChunk, ExternalParticipantListMarker, ExternalParticipantListMarkers as ExternalParticipantMarkers, ExternalParticipantId, DisplayLayoutRequest, GetParticipantsSignalingResponse, GetRoomsSignalingResponse, HangupReasonData, IApiEnv, IAPIBaseUrl, IAsrStartParams, IAsrStopParams, IAsrData, IceServer, JSONArray, JSONObject, JSONType, Layout, MediaModifiers, MediaSettings, MuteStates, OkUserId, ParamsObject, ParticipantId, ParticipantLayout, ParticipantListMarkers, ParticipantListType, ParticipantPriority, ParticipantsStateList, ParticipantStateData, ParticipantStateDataKey, ParticipantStateMapped, ParticipantStreamDescription, ParticipantListChunkParameters, ParticipantListMarker, RequestKeyFrame, Rooms, IGetParticipantsParameters, ScreenCaptureSettings, SignalingMessage, StatResult, StopStream, WaitingHallResponse, IMovieMetaData, IVideoDimentions, IFeedbackExternal, ISharedMovieInfo, ISharedMovieStoppedInfo, ISharedMovieState, ISharedMovieStateResponse, IAddMovieParams, IOnRemoteMovieData, IMoviePreview, IRoomId, Room, RoomsUpdate, RoomParticipantUpdate, IUpdateMovieData, IFeaturesPerRole, IMuteParticipantParams, IMuteParticipantInternalParams, IStartStreamData, IStopStreamData, IPublishStreamData, VmojiError, FastStartHandler, FastStartParams, FastJoinHandler, FastJoinParams, FastJoinResponse, FastHangupHandler, FastHangupParams, FastHangupResponse, HangupParams, };
785
808
  export { Api, AuthData, BaseLogger, CallDirection, CallType, ChatRoomEventType, ConversationOption, DebugMessageType, ExternalIdType, FacingMode, FatalError, HangupReason, HangupType, MediaOption, MediaTrackKind, MediaType, MuteState, ParticipantState, ParticipantStateDataValue, ParticipantStatus, RecordRole, Signaling, SignalingCommandType, SignalingConnectionType, SignalingNotification, UserRole, UserType, TransportTopology, RoomsEventType, ConversationFeature, ArrayDequeue, ApiExternal, VolumeDetector, };
@@ -1,5 +1,6 @@
1
1
  import CallType from '../enums/CallType';
2
2
  import HangupType from '../enums/HangupType';
3
+ import { IHangupParams } from '../types/Api';
3
4
  import { ConversationData } from '../types/Conversation';
4
5
  import ConversationParams from '../types/ConversationParams';
5
6
  import ConversationResponse from '../types/ConversationResponse';
@@ -79,7 +80,7 @@ export default abstract class BaseApi {
79
80
  unmapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId): void;
80
81
  getDecorativeIdByInitialId(okId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
81
82
  replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
82
- hangupConversation(conversationId: string, reason?: HangupType): void;
83
+ hangupConversation(conversationId: string, reason?: HangupType, hangupParams?: Partial<IHangupParams>): void;
83
84
  removeHistoryRecords(recordIds: number[]): Promise<void>;
84
85
  getServerTime(): Promise<number>;
85
86
  cleanup(): void;
@@ -45,6 +45,9 @@ export interface AddParticipantParams {
45
45
  export declare class SignalingDisposedError extends Error {
46
46
  constructor(command?: string);
47
47
  }
48
+ export declare class ProducerConnectionClosedError extends Error {
49
+ constructor(command?: string);
50
+ }
48
51
  /**
49
52
  * Should trigger SignalingEvent.NOTIFICATION on notification message and SignalingEvent.FAILED on error
50
53
  * https://wiki.odkl.ru/display/projects/Signaling+API#SignalingAPI-Notifications
@@ -62,7 +65,7 @@ export default abstract class BaseSignaling extends EventEmitter {
62
65
  abstract hangup(reason: string): Promise<SignalingMessage | void>;
63
66
  abstract acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
64
67
  abstract sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
65
- abstract sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
68
+ abstract sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
66
69
  abstract changeMediaSettings(mediaSettings: MediaSettings): Promise<SignalingMessage>;
67
70
  abstract changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<SignalingMessage>;
68
71
  abstract hold(hold: boolean, capabilities?: TCapabilities): Promise<SignalingMessage>;
@@ -122,6 +125,7 @@ export default abstract class BaseSignaling extends EventEmitter {
122
125
  abstract setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
123
126
  abstract setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
124
127
  abstract useCommandDataChannel(status: boolean): void;
128
+ abstract resetProducerConnection(cause?: Error): void;
125
129
  abstract getParticipantListChunk(participantListChunkParameters: ParticipantListChunkParameters): Promise<SignalingMessage>;
126
130
  abstract getParticipants(externalIds: SignalingMessage.ExternalId[]): Promise<GetParticipantsSignalingResponse>;
127
131
  abstract getPeerId(): number | null;