@vkontakte/calls-sdk 2.8.12-dev.a8c44bc8.0 → 2.8.12-dev.bbebddf4.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 +10 -5
  4. package/calls-sdk.cjs.js +7 -13
  5. package/calls-sdk.esm.js +1650 -1404
  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 +9 -13
  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 +27 -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 +4 -7
  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.a8c44bc8.0",
3
+ "version": "2.8.12-dev.bbebddf4.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
  *
@@ -505,6 +513,16 @@ export type ParamsObject = {
505
513
  * _По умолчанию: `false`_
506
514
  */
507
515
  enableSessionStateUpdates: boolean;
516
+ /**
517
+ * Использовать `<audio>` вместо `<video>` для воспроизведения звука в desktop Safari
518
+ * @hidden
519
+ */
520
+ safariAudioElement: boolean;
521
+ /**
522
+ * Отправлять пустой ICE candidate (end-of-candidates) удалённому пиру
523
+ * @hidden
524
+ */
525
+ forwardEmptyIceCandidate: boolean;
508
526
  /**
509
527
  * Получен локальный стрим с камеры/микрофона
510
528
  */
@@ -960,6 +978,10 @@ export default abstract class Params {
960
978
  static get displaySurface(): DisplayCaptureSurfaceType;
961
979
  static get audioEffects(): EffectVoiceChange | null;
962
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);
963
985
  static get videoEffects(): VideoEffects | null;
964
986
  static set videoEffects(value: VideoEffects | null);
965
987
  static get videoEffectMaxWidth(): number;
@@ -1027,6 +1049,8 @@ export default abstract class Params {
1027
1049
  static get waitForRecordResponse(): boolean;
1028
1050
  static get transparentAudio(): boolean;
1029
1051
  static get enableSessionStateUpdates(): boolean;
1052
+ static get safariAudioElement(): boolean;
1053
+ static get forwardEmptyIceCandidate(): boolean;
1030
1054
  static toJSON(): {
1031
1055
  apiKey: string;
1032
1056
  apiEnv: string;
@@ -1063,5 +1087,7 @@ export default abstract class Params {
1063
1087
  waitForRecordResponse: boolean;
1064
1088
  transparentAudio: boolean;
1065
1089
  enableSessionStateUpdates: boolean;
1090
+ safariAudioElement: boolean;
1091
+ forwardEmptyIceCandidate: boolean;
1066
1092
  };
1067
1093
  }
@@ -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,17 +143,14 @@ 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
  */
154
149
  function canPreferH264(): boolean;
155
150
  /**
156
- * Некоторые браузеры (Firefox, Safari) некорректно поддерживают симулкаст
151
+ * Поддержка simulcast браузером.
152
+ * Safari корректно поддерживает simulcast начиная с версии 18.
153
+ * Firefox поддерживает simulcast с VP8 начиная с версии 134.
157
154
  */
158
155
  function isSimulcastSupportedByBrowser(): boolean;
159
156
  /**
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>;