@vkontakte/calls-sdk 2.8.6-dev.1d6b5a10.0 → 2.8.6-dev.1df341c4.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 (44) hide show
  1. package/CallsSDK.d.ts +25 -9
  2. package/abstract/BaseApi.d.ts +2 -1
  3. package/abstract/BaseSignaling.d.ts +3 -1
  4. package/calls-sdk.cjs.js +8 -8
  5. package/calls-sdk.esm.js +8 -8
  6. package/classes/Conversation.d.ts +19 -9
  7. package/classes/Logger.d.ts +3 -0
  8. package/classes/SignalingActor.d.ts +9 -0
  9. package/classes/codec/IEncoder.d.ts +0 -1
  10. package/classes/screenshare/BaseStreamBuilder.d.ts +1 -1
  11. package/classes/stat/CodecStatsAggregator.d.ts +19 -0
  12. package/classes/stat/EventMetricsService.d.ts +9 -0
  13. package/classes/transport/Statistics.d.ts +23 -10
  14. package/default/Api.d.ts +2 -1
  15. package/default/Signaling.d.ts +18 -10
  16. package/enums/ChatRoomEventType.d.ts +1 -1
  17. package/enums/ConversationOption.d.ts +3 -3
  18. package/enums/RecordRole.d.ts +1 -1
  19. package/enums/SignalingTransportStat.d.ts +17 -0
  20. package/enums/Stat.d.ts +36 -21
  21. package/package.json +6 -2
  22. package/static/ApiTransport.d.ts +1 -1
  23. package/static/External.d.ts +2 -2
  24. package/static/Params.d.ts +48 -17
  25. package/static/SimulcastInfo.d.ts +1 -1
  26. package/static/Utils.d.ts +1 -1
  27. package/types/Conversation.d.ts +28 -1
  28. package/types/ConversationParams.d.ts +14 -1
  29. package/types/ConversationResponse.d.ts +9 -0
  30. package/types/ExternalId.d.ts +3 -0
  31. package/types/FastStart.d.ts +46 -0
  32. package/types/PerfStatReporter.d.ts +1 -1
  33. package/types/SignalingMessage.d.ts +2 -1
  34. package/types/Statistics.d.ts +147 -0
  35. package/types/Streams.d.ts +1 -0
  36. package/types/WebTransport.d.ts +25 -0
  37. package/utils/LengthPrefixed.d.ts +48 -0
  38. package/utils/Lz4.d.ts +1 -0
  39. package/utils/MsgPackerBufferUtils.d.ts +1 -1
  40. package/utils/VariableLengthInteger.d.ts +18 -0
  41. package/worker/LibVPxDecoderWorker.d.ts +0 -1
  42. package/worker/LibVPxEncoderWorker.d.ts +0 -1
  43. package/worker/WebCodecsDecoderWorker.d.ts +0 -1
  44. package/worker/WebCodecsEncoderWorker.d.ts +0 -1
package/static/Utils.d.ts CHANGED
@@ -71,7 +71,7 @@ declare namespace Utils {
71
71
  function participantMarkerCompare(marker1: ExternalParticipantListMarker | undefined, marker2: ExternalParticipantListMarker | undefined): number;
72
72
  /** убирает все ключи со значением `V` на 1 уровне */
73
73
  function objectFilterOutValues<T extends Record<string, V>, V = unknown>(obj: T, value?: unknown | unknown[]): Partial<T>;
74
- function objectReduce<R, T extends Object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
74
+ function objectReduce<R, T extends object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
75
75
  const setImmediate: (fn: VoidFunction) => VoidFunction;
76
76
  function isObject(obj: unknown): obj is object;
77
77
  function patchSimulcastAnswerSdp(sdp: string, trans: RTCRtpTransceiver, width: number, height: number): string;
@@ -1,11 +1,14 @@
1
1
  import { TransportTopology } from '../classes/transport/Transport';
2
2
  import CallDirection from '../enums/CallDirection';
3
+ import CallType from '../enums/CallType';
3
4
  import ConversationFeature from '../enums/ConversationFeature';
4
5
  import ConversationOption from '../enums/ConversationOption';
6
+ import MediaOption from '../enums/MediaOption';
5
7
  import UserRole from '../enums/UserRole';
6
8
  import { AsrInfo } from './Asr';
7
9
  import { IFeaturesPerRole } from './ConversationFeature';
8
- import { ExternalParticipantId } from './ExternalId';
10
+ import { ExternalId, ExternalParticipantId } from './ExternalId';
11
+ import { FastStartHandler } from './FastStart';
9
12
  import MediaModifiers from './MediaModifiers';
10
13
  import MuteStates from './MuteStates';
11
14
  import { OkUserId, ParticipantId } from './Participant';
@@ -68,3 +71,27 @@ export type ConversationData = {
68
71
  /** @hidden */
69
72
  urlSharingInfoByRoom: Map<IRoomId, RoomUrlSharingInfo>;
70
73
  };
74
+ export type ConversationOnStartParams = {
75
+ opponentIds?: OkUserId[];
76
+ opponentType: CallType;
77
+ mediaOptions: MediaOption[];
78
+ payload?: string;
79
+ joiningAllowed?: boolean;
80
+ requireAuthToJoin?: boolean;
81
+ onlyAdminCanShareMovie?: boolean;
82
+ externalIds?: ExternalId[];
83
+ onFastStart?: FastStartHandler;
84
+ };
85
+ export type StartConversationParams = {
86
+ opponentIds?: OkUserId[];
87
+ opponentType: CallType;
88
+ direction: CallDirection;
89
+ mediaOptions: MediaOption[];
90
+ payload?: string;
91
+ joiningAllowed?: boolean;
92
+ requireAuthToJoin?: boolean;
93
+ onlyAdminCanShareMovie?: boolean;
94
+ externalIds?: ExternalId[];
95
+ startedTime: number;
96
+ onFastStart?: FastStartHandler;
97
+ };
@@ -2,6 +2,7 @@ import IceServer from './IceServer';
2
2
  type ConversationParams = {
3
3
  token: string;
4
4
  endpoint: string;
5
+ wt_endpoint?: string;
5
6
  turn_server?: IceServer;
6
7
  stun_server?: IceServer;
7
8
  client_type?: string;
@@ -10,6 +11,18 @@ type ConversationParams = {
10
11
  isp_as_org?: string;
11
12
  loc_cc?: string;
12
13
  loc_reg?: string;
13
- external_user_type: string;
14
+ external_user_type?: string;
15
+ };
16
+ export type ExternalConversationParams = {
17
+ et: number;
18
+ iv: boolean;
19
+ srcp: string;
20
+ stne: string;
21
+ tkn: string;
22
+ trne: string;
23
+ trnp: string;
24
+ trnu: string;
25
+ wse: string;
26
+ wte: string;
14
27
  };
15
28
  export default ConversationParams;
@@ -1,4 +1,5 @@
1
1
  import HangupType from '../enums/HangupType';
2
+ import IceServer from './IceServer';
2
3
  /**
3
4
  * Начальные данные создания звонка
4
5
  * @hidden
@@ -12,6 +13,10 @@ type ConversationResponse = {
12
13
  * URL для подключения
13
14
  */
14
15
  endpoint: string;
16
+ /**
17
+ * URL для подключения по WebTransport
18
+ */
19
+ wt_endpoint?: string;
15
20
  /**
16
21
  * Токен комнаты для подключения к звонку по ссылке
17
22
  */
@@ -27,5 +32,9 @@ type ConversationResponse = {
27
32
  * Порядковый номер, присвоенный устройству при входе в звонок
28
33
  */
29
34
  device_idx?: number;
35
+ turn_server?: IceServer;
36
+ stun_server?: IceServer;
37
+ client_type?: string;
38
+ token: string;
30
39
  };
31
40
  export default ConversationResponse;
@@ -1,4 +1,5 @@
1
1
  import MediaOption from '../enums/MediaOption';
2
+ import UserRole from '../enums/UserRole';
2
3
  import { ParticipantStatus } from '../static/External';
3
4
  import MediaSettings from './MediaSettings';
4
5
  import { ISharedMovieInfo } from './MovieShare';
@@ -19,6 +20,7 @@ export declare namespace ExternalIdUtils {
19
20
  function fromId(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalParticipantId;
20
21
  function fromSignalingParticipant(participant: SignalingMessage.Participant, useDecorative?: boolean): ExternalParticipantId | undefined;
21
22
  function fromSignaling(signalingId: SignalingMessage.ExternalId, deviceIdx?: number): ExternalParticipantId;
23
+ function toSignaling(externalId: ExternalId): string;
22
24
  function toString(externalId: ExternalId): ExternalIdString;
23
25
  function fromIdToString(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalIdString;
24
26
  function fromString(stringId: ExternalIdString): ExternalParticipantId;
@@ -95,6 +97,7 @@ export interface ExternalParticipant {
95
97
  unmuteOptions: MediaOption[];
96
98
  markers: ExternalParticipantListMarkers | null;
97
99
  movieShareInfos?: ISharedMovieInfo[];
100
+ roles: UserRole[];
98
101
  }
99
102
  /**
100
103
  * Позиция в чанке
@@ -0,0 +1,46 @@
1
+ import { HangupType, IceServer } from '../CallsSDK';
2
+ import CallType from '../enums/CallType';
3
+ import MediaOption from '../enums/MediaOption';
4
+ import { ExternalId } from './ExternalId';
5
+ /**
6
+ * Параметры, которые нужно вернуть для создания fastStart
7
+ */
8
+ export interface InternalParams {
9
+ platform: string;
10
+ sdkVersion: string;
11
+ clientAppKey: string;
12
+ deviceId: string;
13
+ protocolVersion: number;
14
+ domainId?: string;
15
+ }
16
+ export interface InternalCallerParams {
17
+ id: ID;
18
+ isConcurrent: boolean;
19
+ endpoint: string;
20
+ wtEndpoint: string;
21
+ clientType: string;
22
+ turn: IceServer;
23
+ stun: IceServer;
24
+ }
25
+ export interface ID {
26
+ internal: number;
27
+ external: string;
28
+ }
29
+ export interface FastStartParams {
30
+ conversationId: string;
31
+ internalParams: string;
32
+ externalIds?: ExternalId[];
33
+ opponentType: CallType;
34
+ mediaOptions: MediaOption[];
35
+ joiningAllowed?: boolean;
36
+ requireAuthToJoin?: boolean;
37
+ isVideo?: boolean;
38
+ }
39
+ export interface FastStartResponse {
40
+ internalCallerParams: string;
41
+ rejectedParticipants: {
42
+ id: string;
43
+ status: HangupType;
44
+ }[];
45
+ }
46
+ export type FastStartHandler = (params: FastStartParams) => Promise<FastStartResponse>;
@@ -45,6 +45,6 @@ export interface ICallStatLog extends Pick<CallStatReport, 'call_topology' | 'na
45
45
  concealment_audio_avg_size?: number;
46
46
  video_loss?: number;
47
47
  audio_loss?: number;
48
- hardware_concurrency?: number;
48
+ cpu_hardware_concurrency?: number;
49
49
  [k: string]: string | number | undefined;
50
50
  }
@@ -133,6 +133,7 @@ declare namespace SignalingMessage {
133
133
  muteStates?: MuteStates;
134
134
  asrInfo?: AsrInfo;
135
135
  urlSharingInfo?: RoomUrlSharingInfo;
136
+ joinLink?: string;
136
137
  }
137
138
  export interface Room {
138
139
  active?: boolean;
@@ -275,7 +276,6 @@ declare namespace SignalingMessage {
275
276
  }
276
277
  export interface FeatureSetChanged extends Notification {
277
278
  features: ConversationFeature[];
278
- featuresPerRole?: IFeaturesPerRole | null;
279
279
  }
280
280
  export interface MultipartyChatCreated extends Notification {
281
281
  chatId: string;
@@ -288,6 +288,7 @@ declare namespace SignalingMessage {
288
288
  recordInfo: RecordInfo;
289
289
  }
290
290
  export interface RecordStopped extends Notification {
291
+ /** кто остановил запись или если в комнатах, то это админ */
291
292
  participant: ParticipantId;
292
293
  recordMovieId: number;
293
294
  }
@@ -27,47 +27,194 @@ export interface ILocalIceCandidateStat extends IRemoteIceCandidateStat {
27
27
  interface StatRtpOutboundVideo {
28
28
  frameHeight?: number;
29
29
  frameWidth?: number;
30
+ /**
31
+ * Идентификатор потока RTP (RID).
32
+ *
33
+ * Используется для идентификации различных потоков видео (например, simulcast) в сессиях WebRTC.
34
+ */
30
35
  rid?: string;
31
36
  framesSent?: number;
32
37
  framesPerSecond?: number;
33
38
  targetBitrate?: number;
34
39
  }
35
40
  export interface StatRtp extends StatRtpOutboundVideo {
41
+ /**
42
+ * Уникальный идентификатор источника синхронизации RTP
43
+ */
36
44
  ssrc: number;
45
+ /**
46
+ * Идентификатор медиалинии (MID)
47
+ *
48
+ * Используется для уникальной идентификации медиалинии в рамках WebRTC-сессии.
49
+ * MID помогает сопоставлять медиапотоки с их соответствующими трансиверами.
50
+ */
51
+ mid?: string;
52
+ /**
53
+ * Тип статистики (например, inbound-rtp, outbound-rtp)
54
+ */
37
55
  type: string;
56
+ /**
57
+ * Тип медиа (например, audio, video)
58
+ */
38
59
  kind: string;
60
+ /**
61
+ * Общее количество байтов, полученных по этому потоку
62
+ */
39
63
  bytesReceived: number;
64
+ /**
65
+ * Общее количество байтов, отправленных по этому потоку
66
+ */
40
67
  bytesSent: number;
68
+ /**
69
+ * Общее количество байтов заголовков, полученных по этому потоку
70
+ */
41
71
  headerBytesReceived: number;
72
+ /**
73
+ * Общее количество байтов заголовков, отправленных по этому потоку
74
+ */
42
75
  headerBytesSent: number;
76
+ /**
77
+ * Среднее значение джиттера в секундах
78
+ * Джиттер — это вариация задержки в получении пакетов данных.
79
+ */
43
80
  jitter: number;
81
+ /**
82
+ * Общее количество потерянных пакетов
83
+ */
44
84
  packetsLost: number;
85
+ /**
86
+ * Общее количество полученных пакетов
87
+ */
45
88
  packetsReceived: number;
89
+ /**
90
+ * Общее количество отправленных пакетов
91
+ */
46
92
  packetsSent: number;
93
+ /**
94
+ * Доля потерянных пакетов
95
+ */
47
96
  fractionLost: number;
97
+ /**
98
+ * Количество Picture Loss Indication (PLI) сообщений
99
+ * PLI — это сообщения, указывающие на потерю кадров изображения.
100
+ */
48
101
  pliCount: number;
102
+ /**
103
+ * Количество Full Intra Request (FIR) сообщений
104
+ * FIR — это запросы на отправку полного внутрикодированного кадра.
105
+ */
49
106
  firCount: number;
107
+ /**
108
+ * Количество Negative ACKnowledgement (NACK) сообщений
109
+ * NACK — это сообщения, указывающие на потерю пакетов данных.
110
+ */
50
111
  nackCount: number;
112
+ /**
113
+ * Идентификатор пользователя, связанный с этим потоком
114
+ */
51
115
  userId?: string;
116
+ /**
117
+ * Пропускная способность в битах в секунду
118
+ */
52
119
  bandwidth?: number;
120
+ /**
121
+ * Процент потерянных пакетов
122
+ */
53
123
  packetLoss?: number;
124
+ /**
125
+ * Частота дискретизации в герцах
126
+ * Частота дискретизации определяет качество звука.
127
+ */
54
128
  clockRate?: number;
129
+ /**
130
+ * Название кодека
131
+ * @example audio/opus, video/vp8
132
+ */
55
133
  mimeType?: string;
134
+ /**
135
+ * Библиотека, которая используется для кодека
136
+ */
137
+ encoderImplementation?: string;
138
+ /**
139
+ * Библиотека, которая используется для декодера
140
+ */
141
+ decoderImplementation?: string;
142
+ /**
143
+ * Параметры кодека, есть только у audio кодеков
144
+ */
145
+ sdpFmtpLine?: string;
146
+ /**
147
+ * Общее количество декодированных кадров
148
+ */
56
149
  framesDecoded?: number;
150
+ /**
151
+ * Общее количество полученных кадров
152
+ */
57
153
  framesReceived?: number;
154
+ /**
155
+ * Общее количество отброшенных кадров
156
+ */
58
157
  framesDropped?: number;
158
+ /**
159
+ * Изменение количества отброшенных кадров
160
+ */
59
161
  framesDroppedDelta?: number;
162
+ /**
163
+ * Изменение задержки между кадрами
164
+ */
60
165
  interframeDelayVariance?: number;
166
+ /**
167
+ * Общее количество полученных аудиосэмплов
168
+ */
61
169
  totalSamplesReceived?: number;
170
+ /**
171
+ * Общее время кодирования видео в секундах.
172
+ *
173
+ * Показывает, сколько времени было потрачено на кодирование видео кадров.
174
+ * Не применяется для аудио.
175
+ */
176
+ totalEncodeTime?: number;
177
+ /**
178
+ * Общее количество замаскированных сэмплов
179
+ */
62
180
  concealedSamples?: number;
181
+ /**
182
+ * Количество вставленных сэмплов для замедления
183
+ */
63
184
  insertedSamplesForDeceleration?: number;
185
+ /**
186
+ * Количество удаленных сэмплов для ускорения
187
+ */
64
188
  removedSamplesForAcceleration?: number;
189
+ /**
190
+ * Количество замаскированных беззвучных сэмплов
191
+ */
65
192
  silentConcealedSamples?: number;
193
+ /**
194
+ * Количество событий маскировки
195
+ */
66
196
  concealmentEvents?: number;
197
+ /**
198
+ * Общее количество аудиоэнергии
199
+ * Аудиоэнергия — это мера мощности аудиосигнала.
200
+ */
67
201
  totalAudioEnergy?: number;
202
+ /**
203
+ * Общее время замерзания в секундах
204
+ */
68
205
  totalFreezesDuration: number;
206
+ /**
207
+ * Изменение общего времени замерзания
208
+ * Время замерзания — это период, в течение которого поток временно останавливается.
209
+ */
69
210
  totalFreezesDurationDelta?: number;
211
+ /**
212
+ * Количество событий замерзания
213
+ */
70
214
  freezeCount: number;
215
+ /**
216
+ * Изменение количества событий замерзания
217
+ */
71
218
  freezeCountDelta?: number;
72
219
  }
73
220
  export type StatItem = {
@@ -9,6 +9,7 @@ export interface IStartStreamData {
9
9
  }
10
10
  export interface IStopStreamData {
11
11
  roomId: number | null;
12
+ remove?: boolean;
12
13
  }
13
14
  export interface IPublishStreamData {
14
15
  roomId: number | null;
@@ -0,0 +1,25 @@
1
+ import { WebTransportOptions } from '@fails-components/webtransport';
2
+ declare class WebTransportEventual {
3
+ private webTransport;
4
+ private stream;
5
+ private writer;
6
+ private reader;
7
+ private readonly url;
8
+ private readonly options;
9
+ private readonly compression;
10
+ private encoder;
11
+ private decoder;
12
+ onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
13
+ onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
14
+ onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
15
+ onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
16
+ readyState: number;
17
+ constructor(url: string, options?: WebTransportOptions);
18
+ private getCompressionTypeFromUrl;
19
+ private connect;
20
+ private readLoop;
21
+ send(data: string): Promise<void>;
22
+ close(code?: number, reason?: string): void;
23
+ static isBrowserSupported(): boolean;
24
+ }
25
+ export { WebTransportEventual as WebTransport };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Encodes a string into a Uint8Array, prepending the length of the string as a variable-length integer and optionally compressing it.
3
+ */
4
+ declare class LengthPrefixedTextEncoder {
5
+ private readonly encoder;
6
+ private readonly compression;
7
+ private readonly lengthEncoder;
8
+ constructor(compression?: 'gzip' | 'deflate' | 'deflate-raw' | null);
9
+ /**
10
+ * Encodes the given string into a Uint8Array.
11
+ *
12
+ * @param data The string to encode.
13
+ * @returns A Uint8Array containing the length-prefixed and optionally compressed encoded string.
14
+ * @throws {RangeError} If the string length exceeds the maximum representable value.
15
+ */
16
+ encode(data: string): Uint8Array;
17
+ private compress;
18
+ }
19
+ /**
20
+ * Decodes a stream of Uint8Arrays into strings, where each string
21
+ * is prefixed by its length as a variable-length integer and optionally decompressed.
22
+ */
23
+ declare class LengthPrefixedTextDecoder {
24
+ private readonly decoder;
25
+ private readonly compression;
26
+ private readonly lengthDecoder;
27
+ private buffer;
28
+ private expectedLength;
29
+ private offset;
30
+ private lengthPrefixLength;
31
+ constructor(compression?: 'gzip' | 'deflate' | 'deflate-raw' | null);
32
+ /**
33
+ * Decodes a Uint8Array into a list of strings.
34
+ *
35
+ * @param data The Uint8Array to decode.
36
+ * @returns An array of decoded strings.
37
+ */
38
+ decode(data: Uint8Array): string[];
39
+ /**
40
+ * Reads the length prefix from the beginning of the data.
41
+ *
42
+ * @param data The Uint8Array containing the length prefix.
43
+ * @returns The length of the message, or null if there's not enough data to read the length.
44
+ */
45
+ private readLength;
46
+ private decompress;
47
+ }
48
+ export { LengthPrefixedTextEncoder, LengthPrefixedTextDecoder };
package/utils/Lz4.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function lz4Decompress(input: Uint8Array, outputLength: number): Uint8Array<ArrayBuffer>;
@@ -13,7 +13,7 @@ export declare function createWriteBuffer(): {
13
13
  putUi32(v: number): void;
14
14
  putUi64(v: number): void;
15
15
  putF(v: number): void;
16
- ui8array(): Uint8Array;
16
+ ui8array(): Uint8Array<ArrayBuffer>;
17
17
  };
18
18
  export declare function createReadBuffer(buf: BufferSource): {
19
19
  peek(): number;
@@ -0,0 +1,18 @@
1
+ declare class VariableLengthIntegerEncoder {
2
+ /**
3
+ * Encodes an integer using a variable-length integer encoding.
4
+ * @param num The number to encode.
5
+ * @returns A Uint8Array representing the encoded integer.
6
+ */
7
+ encode(num: number | bigint): Uint8Array;
8
+ }
9
+ declare class VariableLengthIntegerDecoder {
10
+ /**
11
+ * Decodes an integer from a Uint8Array using variable-length integer encoding.
12
+ * @param data The Uint8Array to decode.
13
+ * @returns The decoded integer.
14
+ */
15
+ decode(data: Uint8Array): bigint | null;
16
+ getNumBytesForLengthInteger(data: Uint8Array): number;
17
+ }
18
+ export { VariableLengthIntegerEncoder, VariableLengthIntegerDecoder };
@@ -1,4 +1,3 @@
1
- /// <reference lib="webworker" />
2
1
  import type libvpx from '@vkontakte/libvpx';
3
2
  declare const _default: (vpx: typeof libvpx, urlResolver: (url: string) => string) => void;
4
3
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference lib="webworker" />
2
1
  import type libvpx from '@vkontakte/libvpx';
3
2
  declare const _default: (vpx: typeof libvpx, urlResolver: (url: string) => string, useCongestionControl: boolean, maxBitrate: number) => void;
4
3
  export default _default;
@@ -1,3 +1,2 @@
1
- /// <reference lib="webworker" />
2
1
  declare const _default: (videoFrameTransferable: boolean) => void;
3
2
  export default _default;
@@ -1,3 +1,2 @@
1
- /// <reference lib="webworker" />
2
1
  declare const _default: () => void;
3
2
  export default _default;