@vkontakte/calls-sdk 2.8.12-beta.11 → 2.8.12-beta.13

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.
@@ -58,6 +58,8 @@ export declare class MediaSource extends EventEmitter {
58
58
  private readonly _videoEffectsFpsLimiter?;
59
59
  private readonly _debug;
60
60
  private readonly _logger;
61
+ private _cameraTrackSetAt;
62
+ private _cameraMuteRecoveredAt;
61
63
  constructor(debug?: DebugLogger, logger?: StatsLogger | null);
62
64
  get cameraVideoTrack(): MediaStreamTrack | null;
63
65
  set cameraVideoTrack(track: MediaStreamTrack | null);
@@ -97,6 +99,8 @@ export declare class MediaSource extends EventEmitter {
97
99
  protected getSilentAudioShareTrack(): MediaStreamTrack;
98
100
  protected getBlackScreenShareTrack(): MediaStreamTrack;
99
101
  protected _replaceLocalTrack(newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
102
+ protected _replaceTrack(oldTrack: MediaStreamTrack, newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
103
+ protected _addLocalTrack(newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
100
104
  private _setEffect;
101
105
  private _stopEffect;
102
106
  destroy(): void;
@@ -5,6 +5,7 @@ import BaseLogger from '../../abstract/BaseLogger';
5
5
  import { AddParticipantParams } from '../../abstract/BaseSignaling';
6
6
  import ConversationFeature from '../../enums/ConversationFeature';
7
7
  import ConversationOption from '../../enums/ConversationOption';
8
+ import type ClientHangupReason from '../../enums/ClientHangupReason';
8
9
  import MediaOption from '../../enums/MediaOption';
9
10
  import UpdateDisplayLayoutErrorReason from '../../enums/UpdateDisplayLayoutErrorReason';
10
11
  import UserRole from '../../enums/UserRole';
@@ -104,8 +105,8 @@ export default class Conversation extends EventEmitter {
104
105
  private _getMainRoomParticipants;
105
106
  private _decodeExternalConversationParams;
106
107
  accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
107
- decline(): Promise<void>;
108
- hangup(): Promise<void>;
108
+ decline(reason?: ClientHangupReason): Promise<void>;
109
+ hangup(reason?: ClientHangupReason): Promise<void>;
109
110
  addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<void>;
110
111
  addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
111
112
  removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
@@ -115,6 +116,7 @@ export default class Conversation extends EventEmitter {
115
116
  private _allocateParticipantTransport;
116
117
  private _cleanupRegistry;
117
118
  private _emitHangupOnce;
119
+ private _sendHangupApi;
118
120
  private _close;
119
121
  destroy(): void;
120
122
  private _destroy;
@@ -4,9 +4,13 @@ import StatsLogger from '../StatsLogger';
4
4
  export declare class StatAggregator {
5
5
  private readonly _logger;
6
6
  private readonly _eventualLogs;
7
+ private _lastCallStatContext;
7
8
  constructor(logger: StatsLogger);
8
9
  logCallStat(params: ICallStatLog): void;
9
10
  /** @link https://wiki.odkl.ru/pages/viewpage.action?pageId=100892588 */
10
11
  logEventualStat(params: IEventualStatLog): void;
11
12
  destroy(): void;
13
+ private _getCallStatContext;
14
+ private _flushEventualStats;
15
+ private _logEventualStat;
12
16
  }
@@ -43,6 +43,7 @@ export default class ServerTransport extends BaseTransport {
43
43
  private _producerSessionId;
44
44
  private _newAudioShareTrack;
45
45
  private _simulcastInfo;
46
+ private _isSimulcastNegotiated;
46
47
  private readonly _debug;
47
48
  private readonly _logger;
48
49
  private readonly _statAggregator;
@@ -50,6 +50,7 @@ export declare class Transport extends EventEmitter {
50
50
  private readonly _codecStatsAggregator;
51
51
  private readonly _onFirstMediaSent;
52
52
  private _firstMediaSentProbeStopped;
53
+ private _vadController;
53
54
  constructor(topology: TransportTopology, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
54
55
  updateSettings(settings: ServerSettings): void;
55
56
  updateStatisticsInterval(): void;
@@ -96,6 +97,8 @@ export declare class Transport extends EventEmitter {
96
97
  private _onAnimojiStream;
97
98
  /** Обработчик, досылающий MediaSourceEvent.SOURCE_CHANGED событие до аллокации транспортов */
98
99
  private _onAnimojiStatus;
100
+ private _createVad;
101
+ private _updateVadTrack;
99
102
  private _createAnimojiTransport;
100
103
  private _removeAnimojiTransport;
101
104
  getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
package/default/Api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import BaseApi, { ClientStats } from '../abstract/BaseApi';
2
2
  import CallType from '../enums/CallType';
3
3
  import HangupType from '../enums/HangupType';
4
+ import { IHangupParams } from '../types/Api';
4
5
  import ConversationParams from '../types/ConversationParams';
5
6
  import ConversationResponse from '../types/ConversationResponse';
6
7
  import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
@@ -17,7 +18,9 @@ export default class Api extends BaseApi {
17
18
  private _getCachedAnonymLogin;
18
19
  private _setCachedAnonymLogin;
19
20
  private _removeCachedAnonymLogin;
21
+ private _reauthorize;
20
22
  private _applyAnonymLogin;
23
+ private _sendClientStats;
21
24
  logClientStats(items: ClientStats[]): void;
22
25
  uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
23
26
  joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
@@ -55,7 +58,7 @@ export default class Api extends BaseApi {
55
58
  getConversationParams(conversationId?: string): Promise<ConversationParams>;
56
59
  getUserId(): OkUserId | null;
57
60
  setUserId(userId: OkUserId): void;
58
- hangupConversation(conversationId: string, reason?: HangupType): void;
61
+ hangupConversation(conversationId: string, reason?: HangupType, params?: Partial<IHangupParams>): void;
59
62
  removeHistoryRecords(recordIds: number[]): Promise<void>;
60
63
  cleanup(): void;
61
64
  getServerTime(): Promise<number>;
@@ -1,3 +1,4 @@
1
+ import { IHangupParams } from '../types/Api';
1
2
  import { IAPIBaseUrl, IApiEnv } from '../types/Params';
2
3
  export declare class ApiExternal {
3
4
  private readonly _uuid;
@@ -8,5 +9,5 @@ export declare class ApiExternal {
8
9
  private _sessionKey;
9
10
  constructor(apiEvn: IApiEnv, apiKey: string, callToken: string, baseApiUrl?: IAPIBaseUrl);
10
11
  authorize(): Promise<boolean>;
11
- hangupConversation(conversationId: string): Promise<void>;
12
+ hangupConversation(conversationId: string, params?: Partial<IHangupParams>): Promise<void>;
12
13
  }
@@ -70,7 +70,7 @@ export default class Signaling extends BaseSignaling {
70
70
  connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
71
71
  getNextCommandSequenceNumber(): number;
72
72
  hangup(reason: string): Promise<SignalingMessage>;
73
- sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
73
+ sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
74
74
  requestTestMode(consumerCommand: string, producerCommand: string | null): Promise<SignalingMessage>;
75
75
  sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
76
76
  acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
@@ -0,0 +1,7 @@
1
+ import HangupType from './HangupType';
2
+ /**
3
+ * Причины завершения звонка, которые клиент может передать в {@link hangup}/{@link declineCall}
4
+ * и пробросить в сигналинг без маппинга.
5
+ */
6
+ export type ClientHangupReason = HangupType.HUNGUP | HangupType.CANCELED | HangupType.REJECTED | HangupType.BUSY | HangupType.MISSED | HangupType.CALL_TIMEOUT;
7
+ export default ClientHangupReason;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.12-beta.11",
3
+ "version": "2.8.12-beta.13",
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
  }
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<{
@@ -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
+ }
@@ -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;
@@ -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>;