@vkontakte/calls-sdk 2.8.12-dev.6d679417.0 → 2.8.12-dev.73c9f7fe.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 (43) hide show
  1. package/CallsSDK.d.ts +24 -4
  2. package/abstract/BaseApi.d.ts +2 -1
  3. package/abstract/BaseSignaling.d.ts +9 -4
  4. package/calls-sdk.cjs.js +7 -13
  5. package/calls-sdk.esm.js +1632 -1397
  6. package/classes/CallRegistry.d.ts +1 -1
  7. package/classes/MediaSource.d.ts +4 -0
  8. package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +43 -34
  9. package/classes/conversation/Conversation.testUtils.d.ts +148 -0
  10. package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
  11. package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +4 -4
  12. package/classes/conversation/index.d.ts +1 -0
  13. package/classes/stat/CallLifecycleStats.d.ts +0 -4
  14. package/classes/stat/StatAggregator.d.ts +4 -0
  15. package/classes/transport/DirectTransport.d.ts +1 -0
  16. package/classes/transport/PerfStatReporter.d.ts +2 -0
  17. package/classes/transport/ServerTransport.d.ts +1 -4
  18. package/classes/transport/SimulcastSender.d.ts +31 -0
  19. package/classes/transport/Transport.d.ts +3 -0
  20. package/default/Api.d.ts +4 -1
  21. package/default/ApiExternal.d.ts +2 -1
  22. package/default/Signaling.d.ts +8 -12
  23. package/default/SignalingTransport.d.ts +6 -1
  24. package/enums/ClientHangupReason.d.ts +7 -0
  25. package/enums/Stat.d.ts +0 -1
  26. package/package.json +3 -3
  27. package/static/ApiTransport.d.ts +3 -0
  28. package/static/Params.d.ts +13 -1
  29. package/static/ParticipantConnectionStatusUtils.d.ts +1 -0
  30. package/static/Sdp.d.ts +3 -0
  31. package/static/SignalingCapabilities.d.ts +1 -1
  32. package/static/SimulcastInfo.d.ts +5 -3
  33. package/static/Utils.d.ts +1 -2
  34. package/static/WebRTCUtils.d.ts +1 -6
  35. package/types/Api.d.ts +9 -0
  36. package/types/Capabilities.d.ts +1 -0
  37. package/types/Participant.d.ts +1 -0
  38. package/types/PerfStatReporter.d.ts +0 -4
  39. package/types/SignalingCommand.d.ts +2 -0
  40. package/types/SignalingMessage.d.ts +1 -0
  41. package/utils/IceServers.d.ts +2 -0
  42. package/utils/NavigatorPermissions.d.ts +2 -2
  43. package/utils/SerializeLatest.d.ts +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.12-dev.6d679417.0",
3
+ "version": "2.8.12-dev.73c9f7fe.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",
@@ -14,7 +14,7 @@
14
14
  "**/*.d.ts"
15
15
  ],
16
16
  "dependencies": {
17
- "@vkontakte/calls-audio-effects": "1.2.8",
17
+ "@vkontakte/calls-audio-effects": "1.4.1",
18
18
  "@vkontakte/calls-video-effects": "2.2.3-beta.7",
19
19
  "@vkontakte/calls-vmoji": "1.0.10-beta.17",
20
20
  "@vkontakte/libvpx": "2.0.9",
@@ -22,6 +22,6 @@
22
22
  "fflate": "^0.8.2",
23
23
  "messagepack": "1.1.12",
24
24
  "simple-ebml-builder": "0.2.2",
25
- "webrtc-adapter": "7.7.0"
25
+ "webrtc-adapter": "9.0.5"
26
26
  }
27
27
  }
@@ -7,4 +7,7 @@ export declare function sendBeakon(method: string, params?: {
7
7
  export declare function request(method: string, params?: {
8
8
  [key: string]: any;
9
9
  }, noSession?: boolean, customEndpoint?: string): Promise<any>;
10
+ export declare function requestKeepalive(method: string, params?: {
11
+ [key: string]: any;
12
+ }, noSession?: boolean): Promise<any>;
10
13
  export declare function sendFormData(url: string, data: FormData): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { VideoEffects } from '@vkontakte/calls-video-effects';
2
- import type { EffectVoiceChange } from '@vkontakte/calls-audio-effects';
2
+ import type { EffectVoiceChange, VadControllerOptions, VadLib } from '@vkontakte/calls-audio-effects';
3
3
  import type * as Vmoji from '@vkontakte/calls-vmoji';
4
4
  import { IAsrData } from '../types/Asr';
5
5
  import { ConversationData } from '../types/Conversation';
@@ -193,6 +193,14 @@ export type ParamsObject = {
193
193
  * Можно установить позднее методом `setAudioEffects`
194
194
  */
195
195
  audioEffects: EffectVoiceChange | null;
196
+ /**
197
+ * Namespace библиотеки VAD из `@vkontakte/calls-audio-effects`.
198
+ *
199
+ * Можно установить методом `setVad`
200
+ */
201
+ vad: VadLib | null;
202
+ /** Настройки VAD (threshold, hangoverMs, enabled) */
203
+ vadOptions: VadControllerOptions;
196
204
  /**
197
205
  * Максимальная ширина видео в пикселях для видео эффекта
198
206
  *
@@ -970,6 +978,10 @@ export default abstract class Params {
970
978
  static get displaySurface(): DisplayCaptureSurfaceType;
971
979
  static get audioEffects(): EffectVoiceChange | null;
972
980
  static set audioEffects(value: EffectVoiceChange | null);
981
+ static get vad(): VadLib | null;
982
+ static set vad(value: VadLib | null);
983
+ static get vadOptions(): VadControllerOptions;
984
+ static set vadOptions(value: VadControllerOptions);
973
985
  static get videoEffects(): VideoEffects | null;
974
986
  static set videoEffects(value: VideoEffects | null);
975
987
  static get videoEffectMaxWidth(): number;
@@ -11,6 +11,7 @@ declare namespace ParticipantConnectionStatusUtils {
11
11
  function computeEffective(status: ParticipantConnectionStatus): ParticipantStatus;
12
12
  function setSessionState(status: ParticipantConnectionStatus, sessionState?: ParticipantSessionState, sessionStateConnectedBySpeaker?: boolean): StatusTransition;
13
13
  function setTransport(status: ParticipantConnectionStatus, transport: ParticipantStatus): StatusTransition;
14
+ function setStalled(status: ParticipantConnectionStatus, stalled: boolean): StatusTransition;
14
15
  function setSessionStateApplicable(status: ParticipantConnectionStatus, applicable: boolean): StatusTransition;
15
16
  }
16
17
  export default ParticipantConnectionStatusUtils;
@@ -0,0 +1,3 @@
1
+ export declare const SDP_LINE_ENDING = "\r\n";
2
+ export declare function splitSdpLines(sdp: string): string[];
3
+ export declare function joinSdpLines(lines: string[]): string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @see https://confluence.vk.team/display/VIDEOOK/Websocket+Capability+Flags
2
+ * @see https://confluence.vk.team/display/CALLS/Websocket+Capability+Flags
3
3
  */
4
4
  declare const PREDICATES: {
5
5
  readonly producerScreenTrack: () => boolean;
@@ -6,8 +6,10 @@ export declare const SIMULCAST_DEFAULT: {
6
6
  BITRATE: number;
7
7
  };
8
8
  export declare const SIMULCAST_SCALABILITY_MODE = "L1T2";
9
- export declare const MAP_RID_TO_SCALE_RESOLUTION_DOWN_BY: Record<string, number>;
10
9
  export declare function isEqualSimulcastInfo(si1: ISimulcastInfo | null, si2: ISimulcastInfo | null): boolean;
11
10
  export declare function findBitrateAsc(maxDimension: number, bitrates: VideoBitrateSettings[]): number;
12
- export declare function calculateSimulcastInfo(width?: number, height?: number, bitrates?: VideoBitrateSettings[]): ISimulcastInfo;
13
- export declare function findScaleResolutionDownBy(rid?: string): number;
11
+ export declare function calculateSimulcastInfo(width?: number, height?: number, bitrates?: VideoBitrateSettings[], fps?: number): {
12
+ streams: import("../types/SimulcastInfo").SimulcastStreamInfo[];
13
+ };
14
+ export declare function findScaleResolutionDownBy(rid: string | undefined, simulcastInfo: ISimulcastInfo): number;
15
+ export declare function applySimulcastInfoToEncodings(encodings: RTCRtpEncodingParameters[], simulcastInfo: ISimulcastInfo, maxDimension?: number, maxBitrate?: number): void;
package/static/Utils.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare const DEVICE_IDX_PARAMETER = "d";
9
9
  /** @hidden */
10
10
  declare namespace Utils {
11
11
  function patchLocalSDP(sdp: string, preferH264: boolean, brokenH264Decoder: boolean, preferVP9: boolean, isAudioNack?: boolean): string;
12
- function patchRemoteSDP(sdp: string, oldDataChannelDescription: boolean, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, brokenVP9Encoder: boolean, brokenVP9Decoder: boolean): string;
12
+ function patchRemoteSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, brokenVP9Encoder: boolean, brokenVP9Decoder: boolean): string;
13
13
  function getPeerIdString(peerId: SignalingMessage.PeerId): string;
14
14
  function comparePeerId(peerId1: SignalingMessage.PeerId, peerId2: SignalingMessage.PeerId): boolean;
15
15
  function getPeerConnectionHostInfo(pc: RTCPeerConnection): Promise<{
@@ -77,6 +77,5 @@ declare namespace Utils {
77
77
  function objectReduce<R, T extends object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
78
78
  const setImmediate: (fn: VoidFunction) => VoidFunction;
79
79
  function isObject(obj: unknown): obj is object;
80
- function patchSimulcastAnswerSdp(sdp: string, trans: RTCRtpTransceiver, width: number, height: number): string;
81
80
  }
82
81
  export default Utils;
@@ -20,7 +20,7 @@ export declare enum FacingMode {
20
20
  /**
21
21
  * Известные браузеры
22
22
  */
23
- export type BrowserName = 'IE' | 'Edge' | 'Chrome' | 'Firefox' | 'Yandex' | 'Opera' | 'Sferum';
23
+ export type BrowserName = 'Edge' | 'Chrome' | 'Firefox' | 'Yandex' | 'Opera' | 'Sferum';
24
24
  declare namespace WebRTCUtils {
25
25
  /**
26
26
  * До вызова этого метода бесполезно опрашивать другие публичные методы.
@@ -143,11 +143,6 @@ declare namespace WebRTCUtils {
143
143
  * В некоторых браузерах VP9 decoder сломан
144
144
  */
145
145
  function isBrokenVP9Decoder(): boolean;
146
- /**
147
- * Изменился формат описания датаканала в SDP
148
- * @link https://blog.mozilla.org/webrtc/how-to-avoid-data-channel-breaking/
149
- */
150
- function isOldDataChannelDescription(): boolean;
151
146
  /**
152
147
  * Может ли браузер делать H264 приоритетным
153
148
  */
package/types/Api.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import HangupType from '../enums/HangupType';
2
+ export interface IHangupParams {
3
+ conversationId: string;
4
+ reason: HangupType;
5
+ anonymToken?: string;
6
+ peerId?: string;
7
+ application_key?: string;
8
+ session_key?: string;
9
+ }
@@ -18,6 +18,7 @@ export type TCapabilities = {
18
18
  fastScreenShare: boolean;
19
19
  videoSuspend: boolean;
20
20
  simulcast: boolean;
21
+ simulcastNativeOrder: boolean;
21
22
  consumerFastScreenShare: boolean;
22
23
  consumerFastScreenShareQualityOnDemand: boolean;
23
24
  transparentAudio: boolean;
@@ -49,6 +49,7 @@ export interface ParticipantSessionState {
49
49
  }
50
50
  export interface ParticipantConnectionStatus {
51
51
  transport: ParticipantStatus;
52
+ stalled: boolean;
52
53
  sessionState?: ParticipantSessionState;
53
54
  sessionStateApplicable: boolean;
54
55
  sessionStateConnectedBySpeaker: boolean;
@@ -24,10 +24,6 @@ export interface CallStatReport {
24
24
  audio_concealment_events: number;
25
25
  inbound_video_count: number;
26
26
  inbound_audio_count: number;
27
- packets_lost_video: number;
28
- packets_sent_video: number;
29
- packets_lost_audio: number;
30
- packets_sent_audio: number;
31
27
  freeze_count: number;
32
28
  total_freezes_duration: number;
33
29
  rtt: number;
@@ -1,8 +1,10 @@
1
1
  import SignalingCommandType from '../enums/SignalingCommandType';
2
2
  import { SignalingResponse, SignalingSuccessResponse } from './SignalingMessage';
3
+ export type SignalingCommandRoute = 'websocket' | 'producer';
3
4
  interface SignalingCommand<T extends SignalingResponse = SignalingSuccessResponse> {
4
5
  sequence: number;
5
6
  name: SignalingCommandType;
7
+ route: SignalingCommandRoute;
6
8
  statMarkName: string;
7
9
  params: object;
8
10
  responseTimer: number;
@@ -188,6 +188,7 @@ declare namespace SignalingMessage {
188
188
  peerId: PeerId;
189
189
  mediaSettings: Partial<MediaSettings>;
190
190
  capabilities?: string;
191
+ externalId?: ExternalId;
191
192
  }
192
193
  export interface Hungup extends Notification {
193
194
  participantId: OkUserId;
@@ -0,0 +1,2 @@
1
+ import IceServer from '../types/IceServer';
2
+ export declare function createIceServers(stunServer?: IceServer, turnServer?: IceServer): IceServer[];
@@ -2,8 +2,8 @@ type Device = 'camera' | 'microphone';
2
2
  type PermissionStatusState = typeof PermissionStatus.prototype.state;
3
3
  type EventListener = (name: Device, state: PermissionStatusState) => void;
4
4
  export declare class NavigatorPermissions {
5
- private _cameraPermissionStatus;
6
- private _microphonePermissionStatus;
5
+ private _cameraPermissionStatus?;
6
+ private _microphonePermissionStatus?;
7
7
  private _listener;
8
8
  static isSupported(): boolean;
9
9
  init(listener: EventListener): Promise<void>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Последовательно выполняет операции, оставляя в очереди только последнее запрошенное значение.
3
+ * Возвращает ошибку, только если не удалось применить итоговое состояние.
4
+ */
5
+ export declare function serializeLatest<T>(run: (value: T) => Promise<void> | undefined): (value: T) => Promise<void>;