@vkontakte/calls-sdk 2.8.6-dev.7a7707c0.0 → 2.8.6-dev.7d1edb99.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 (46) hide show
  1. package/CallsSDK.d.ts +26 -10
  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/MediaSource.d.ts +4 -0
  9. package/classes/SignalingActor.d.ts +9 -0
  10. package/classes/codec/IEncoder.d.ts +0 -1
  11. package/classes/screenshare/BaseStreamBuilder.d.ts +1 -1
  12. package/classes/stat/CodecStatsAggregator.d.ts +19 -0
  13. package/classes/stat/EventMetricsService.d.ts +9 -0
  14. package/classes/transport/Statistics.d.ts +23 -10
  15. package/default/Api.d.ts +2 -1
  16. package/default/Signaling.d.ts +18 -10
  17. package/enums/ChatRoomEventType.d.ts +1 -1
  18. package/enums/ConversationOption.d.ts +3 -3
  19. package/enums/RecordRole.d.ts +1 -1
  20. package/enums/SignalingTransportStat.d.ts +17 -0
  21. package/enums/Stat.d.ts +36 -21
  22. package/package.json +6 -2
  23. package/static/ApiTransport.d.ts +1 -1
  24. package/static/External.d.ts +2 -2
  25. package/static/Params.d.ts +48 -17
  26. package/static/SimulcastInfo.d.ts +1 -1
  27. package/static/Utils.d.ts +1 -1
  28. package/types/Conversation.d.ts +28 -1
  29. package/types/ConversationParams.d.ts +14 -1
  30. package/types/ConversationResponse.d.ts +9 -0
  31. package/types/ExternalId.d.ts +3 -0
  32. package/types/FastStart.d.ts +46 -0
  33. package/types/Participant.d.ts +1 -1
  34. package/types/PerfStatReporter.d.ts +1 -1
  35. package/types/SignalingMessage.d.ts +2 -1
  36. package/types/Statistics.d.ts +147 -0
  37. package/types/Streams.d.ts +1 -0
  38. package/types/WebTransport.d.ts +25 -0
  39. package/utils/LengthPrefixed.d.ts +48 -0
  40. package/utils/Lz4.d.ts +1 -0
  41. package/utils/MsgPackerBufferUtils.d.ts +1 -1
  42. package/utils/VariableLengthInteger.d.ts +18 -0
  43. package/worker/LibVPxDecoderWorker.d.ts +0 -1
  44. package/worker/LibVPxEncoderWorker.d.ts +0 -1
  45. package/worker/WebCodecsDecoderWorker.d.ts +0 -1
  46. package/worker/WebCodecsEncoderWorker.d.ts +0 -1
@@ -82,6 +82,8 @@ export type ParamsObject = {
82
82
  /** @hidden */
83
83
  wssBase: string;
84
84
  /** @hidden */
85
+ wtsBase: string;
86
+ /** @hidden */
85
87
  wssToken: string;
86
88
  /** @hidden */
87
89
  signalingReconnectDelay: number;
@@ -461,6 +463,38 @@ export type ParamsObject = {
461
463
  * _По умолчанию: `false`_
462
464
  */
463
465
  enableLogPerfStatReport: boolean;
466
+ /**
467
+ * Поддержка переключения качества видео в зависимости от сети
468
+ * Только для режима p2p
469
+ *
470
+ * _По умолчанию: `false`_
471
+ */
472
+ switchVideoAtBadNetwork: boolean;
473
+ /**
474
+ * Включает деградацию фпс для видео с камеры при низком фпс с включенными вирт фонами
475
+ *
476
+ * _По умолчанию: `false`_
477
+ */
478
+ enableVideoEffectsFpsDegradation: boolean;
479
+ /**
480
+ * Включить поддержку simulcast на отправке
481
+ *
482
+ * _По умолчанию: `false`_
483
+ */
484
+ simulcast: boolean;
485
+ /**
486
+ * Включить поддержку webtransport для сигналинга
487
+ *
488
+ * _По умолчанию: `false`_
489
+ */
490
+ webtransport: boolean;
491
+ /**
492
+ * Включить поддержку webtransport для сигналинга в FireFox
493
+ * Отдельная ручка, так как есть проблемы сейчас с FF
494
+ *
495
+ * _По умолчанию: `false`_
496
+ */
497
+ webtransportFF: boolean;
464
498
  /**
465
499
  * Получен локальный стрим с камеры/микрофона
466
500
  */
@@ -565,8 +599,11 @@ export type ParamsObject = {
565
599
  /**
566
600
  * Получены данные по изменению локальных состояний со стороны админа
567
601
  * Например, принудительно опущена рука
602
+ *
603
+ * @param participantState Полный объект состояния участника, полученный от SDK/сервера.
604
+ * @param global `true` – действие глобальное (для всех участников), `false` – действие локальное (только у текущего пользователя).
568
605
  */
569
- onLocalParticipantState?: (participantState: ParticipantStateMapped) => void;
606
+ onLocalParticipantState?: (participantState: ParticipantStateMapped, global: boolean) => void;
570
607
  /**
571
608
  * Изменились данные состояний собеседника
572
609
  */
@@ -681,7 +718,7 @@ export type ParamsObject = {
681
718
  /**
682
719
  * Закончена трансляция/запись звонка
683
720
  */
684
- onRecordStopped?: (roomId: number | null) => void;
721
+ onRecordStopped?: (roomId: number | null, stopBy: ExternalParticipantId | null) => void;
685
722
  /**
686
723
  * Состояние своей сети
687
724
  *
@@ -834,21 +871,6 @@ export type ParamsObject = {
834
871
  * Собеседник подключился к сигналлингу
835
872
  */
836
873
  onPeerRegistered?: () => void;
837
- /**
838
- * Поддержка переключения качества видео в зависимости от сети
839
- * Только для режима p2p
840
- *
841
- * _По умолчанию: `false`_
842
- */
843
- switchVideoAtBadNetwork: boolean;
844
- /** включает деградацию фпс для видео с камеры при низком фпс с включенными вирт фонами */
845
- enableVideoEffectsFpsDegradation: boolean;
846
- /**
847
- * Включить поддержку simulcast на отправке
848
- *
849
- * _По умолчанию: `false`_
850
- */
851
- simulcast: boolean;
852
874
  };
853
875
  export default abstract class Params {
854
876
  private static _params;
@@ -885,6 +907,8 @@ export default abstract class Params {
885
907
  static set iceServers(value: IceServer[]);
886
908
  static get wssBase(): string;
887
909
  static set wssBase(value: string);
910
+ static get wtsBase(): string;
911
+ static set wtsBase(value: string);
888
912
  static get wssToken(): string;
889
913
  static set wssToken(value: string);
890
914
  static get signalingReconnectDelay(): number;
@@ -978,6 +1002,10 @@ export default abstract class Params {
978
1002
  static get enableVideoEffectsFpsDegradation(): boolean;
979
1003
  static get simulcast(): boolean;
980
1004
  static set simulcast(value: boolean);
1005
+ static get webtransport(): boolean;
1006
+ static set webtransport(value: boolean);
1007
+ static get webtransportFF(): boolean;
1008
+ static set webtransportFF(value: boolean);
981
1009
  static toJSON(): {
982
1010
  apiKey: string;
983
1011
  apiEnv: string;
@@ -1006,5 +1034,8 @@ export default abstract class Params {
1006
1034
  clientStatsPlatform: string;
1007
1035
  consumerScreenDataChannelPacketSize: number;
1008
1036
  switchVideoAtBadNetwork: boolean;
1037
+ simulcast: boolean;
1038
+ webtransport: boolean;
1039
+ webtransportFF: boolean;
1009
1040
  };
1010
1041
  }
@@ -10,4 +10,4 @@ export declare const MAP_RID_TO_SCALE_RESOLUTION_DOWN_BY: Record<string, number>
10
10
  export declare function isEqualSimulcastInfo(si1: ISimulcastInfo | null, si2: ISimulcastInfo | null): boolean;
11
11
  export declare function findBitrateAsc(maxDimension: number, bitrates: VideoBitrateSettings[]): number;
12
12
  export declare function calculateSimulcastInfo(width?: number, height?: number, bitrates?: VideoBitrateSettings[]): ISimulcastInfo;
13
- export declare function findScaleResolutionDownBy(rid: string): number;
13
+ export declare function findScaleResolutionDownBy(rid?: string): number;
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>;
@@ -94,4 +94,4 @@ export declare enum ParticipantStateDataValue {
94
94
  /**
95
95
  * Список состояний в виде ключ-значение. Максимальная длина ключей и значений - 5 символов. Пустые значения будут пропущены
96
96
  */
97
- export type ParticipantStateData = Record<ParticipantStateDataKey, ParticipantStateDataValue>;
97
+ export type ParticipantStateData = Partial<Record<ParticipantStateDataKey, ParticipantStateDataValue>>;
@@ -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;