@vkontakte/calls-sdk 2.6.2-dev.2d30cdd.0 → 2.6.2-dev.30ea81e.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 (45) hide show
  1. package/CallsSDK.d.ts +35 -13
  2. package/abstract/BaseApi.d.ts +1 -1
  3. package/abstract/BaseSignaling.d.ts +9 -3
  4. package/calls-sdk.cjs.js +8 -8
  5. package/calls-sdk.esm.js +8 -8
  6. package/classes/Conversation.d.ts +22 -6
  7. package/classes/MediaSource.d.ts +7 -2
  8. package/classes/ProducerCommandSerializationService.d.ts +2 -0
  9. package/classes/codec/IEncoder.d.ts +3 -0
  10. package/classes/codec/LibVPxEncoder.d.ts +4 -1
  11. package/classes/codec/Types.d.ts +6 -1
  12. package/classes/codec/WebCodecsEncoder.d.ts +4 -1
  13. package/classes/screenshare/PacketHistory.d.ts +30 -0
  14. package/classes/screenshare/PacketHistory.test.d.ts +1 -0
  15. package/classes/screenshare/ScreenCaptureSender.d.ts +15 -1
  16. package/classes/screenshare/ScreenCongestionControl.d.ts +25 -0
  17. package/classes/screenshare/SharingStatReport.d.ts +6 -0
  18. package/classes/screenshare/Utils.d.ts +5 -0
  19. package/classes/transport/ServerTransport.d.ts +2 -0
  20. package/default/Api.d.ts +1 -1
  21. package/default/Signaling.d.ts +9 -3
  22. package/enums/ConversationOption.d.ts +2 -1
  23. package/enums/LiveStatus.d.ts +7 -0
  24. package/enums/MediaOption.d.ts +2 -1
  25. package/enums/SignalingCommandType.d.ts +5 -1
  26. package/enums/SignalingNotification.d.ts +5 -1
  27. package/package.json +1 -1
  28. package/static/External.d.ts +26 -3
  29. package/static/Params.d.ts +41 -3
  30. package/static/Polyfills.d.ts +6 -0
  31. package/static/WebRTCUtils.d.ts +2 -1
  32. package/types/Asr.d.ts +5 -0
  33. package/types/ConversationFeature.d.ts +3 -0
  34. package/types/Feedback.d.ts +22 -0
  35. package/types/MediaSettings.d.ts +4 -0
  36. package/types/MovieShare.d.ts +18 -2
  37. package/types/Participant.d.ts +1 -0
  38. package/types/ParticipantListChunk.d.ts +2 -0
  39. package/types/ParticipantStreamDescription.d.ts +2 -1
  40. package/types/Room.d.ts +16 -4
  41. package/types/SignalingMessage.d.ts +22 -3
  42. package/types/WaitingHall.d.ts +2 -8
  43. package/utils/ArrayDequeue.d.ts +24 -0
  44. package/utils/ArrayDequeue.spec.d.ts +1 -0
  45. package/worker/LibVPxEncoderWorker.d.ts +1 -1
@@ -8,14 +8,16 @@ import FatalError from '../enums/FatalError';
8
8
  import MediaOption from '../enums/MediaOption';
9
9
  import RoomsEventType from '../enums/RoomsEventType';
10
10
  import UserRole from '../enums/UserRole';
11
+ import { IFeaturesPerRole } from '../types/ConversationFeature';
11
12
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalParticipantListMarkers } from '../types/ExternalId';
13
+ import { IFeedbackExternal } from '../types/Feedback';
12
14
  import IceServer from '../types/IceServer';
13
15
  import MediaModifiers from '../types/MediaModifiers';
14
16
  import MediaSettings from '../types/MediaSettings';
15
17
  import { IOnRemoteMovieData, ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from '../types/MovieShare';
16
18
  import MuteStates from '../types/MuteStates';
17
19
  import { ParticipantStateMapped } from '../types/Participant';
18
- import { Room, RoomParticipantUpdate, RoomsUpdate } from '../types/Room';
20
+ import { Room, RoomParticipantUpdate, Rooms, RoomsUpdate } from '../types/Room';
19
21
  import AuthData from './AuthData';
20
22
  import { DebugMessageType } from './Debug';
21
23
  import { ParticipantStatus } from './External';
@@ -239,6 +241,10 @@ export declare type ParamsObject = {
239
241
  * Включить постраничный вывод участников. Работает только если включено videoTracksCount (слоты)
240
242
  */
241
243
  useParticipantListChunk: boolean;
244
+ /**
245
+ * Включить комнаты
246
+ */
247
+ useRooms: boolean;
242
248
  /**
243
249
  * Индекс участника для первого chunk'а который придет при установки соединения с сервером
244
250
  */
@@ -284,6 +290,11 @@ export declare type ParamsObject = {
284
290
  * @hidden
285
291
  */
286
292
  preserveAudioTracks: boolean;
293
+ /**
294
+ * Использовать congestion control для шаринга
295
+ * @hidden
296
+ */
297
+ screenShareCongestionControl: boolean;
287
298
  /**
288
299
  * Получен локальный стрим с камеры/микрофона
289
300
  */
@@ -331,7 +342,7 @@ export declare type ParamsObject = {
331
342
  /**
332
343
  * Начат звонок
333
344
  */
334
- onConversation?: (userId: ExternalParticipantId, mediaModifiers: MediaModifiers, muteStates: MuteStates, participants?: ExternalParticipant[], rooms?: Room[]) => void;
345
+ onConversation?: (userId: ExternalParticipantId, mediaModifiers: MediaModifiers, muteStates: MuteStates, participants?: ExternalParticipant[], rooms?: Rooms) => void;
335
346
  /**
336
347
  * Начальный список участников для постраничного звонка
337
348
  */
@@ -526,14 +537,38 @@ export declare type ParamsObject = {
526
537
  */
527
538
  onJoinLinkChanged?: (joinLink: string) => void;
528
539
  /**
540
+ * Получено обновление списка комнат
541
+ * @param updates список обновлений по комнатам
529
542
  */
530
543
  onRoomsUpdated?: (updates: Partial<Record<RoomsEventType, RoomsUpdate>>) => void;
531
544
  /**
545
+ * Получено обновление комнаты
546
+ * @param eventTypes список событий
547
+ * @param roomId номер комнаты
548
+ * @param room комната
532
549
  */
533
- onRoomUpdated?: (eventTypes: RoomsEventType[], roomId: number, room: Room | null) => void;
550
+ onRoomUpdated?: (eventTypes: RoomsEventType[], roomId: number, room: Room | null, deactivate: boolean | null) => void;
534
551
  /**
552
+ * Получение обновление списка участников в комнате
553
+ * @param update обновление списка участников
535
554
  */
536
555
  onRoomParticipantsUpdated?: (update: RoomParticipantUpdate) => void;
556
+ /**
557
+ * Получены новые реакции в звонке
558
+ * @param feedback массив с реакциями
559
+ */
560
+ onFeedback?: (feedback: IFeedbackExternal[]) => void;
561
+ /**
562
+ * Включать capability c аудио шарой
563
+ */
564
+ audioShareCapabilityEnabled: boolean;
565
+ /**
566
+ * Изменился список ролей, которым доступны ConversationFeatures
567
+ *
568
+ * @param featuresPerRole Объект вида ключ: ConversationFeature = значение: UserRole[]
569
+ * (если ключ фичи отсутствует, или в ролях пустой массив, считаем фичу доступной для всех пользователей)
570
+ */
571
+ onFeaturesPerRoleChanged?: (featuresPerRole: IFeaturesPerRole) => void;
537
572
  };
538
573
  export default abstract class Params {
539
574
  private static _params;
@@ -626,6 +661,7 @@ export default abstract class Params {
626
661
  static get breakVideoPayloadTypes(): boolean;
627
662
  static get filteredMessages(): boolean;
628
663
  static get useParticipantListChunk(): boolean;
664
+ static get useRooms(): boolean;
629
665
  static get participantListChunkInitIndex(): number;
630
666
  static get participantListChunkInitCount(): number;
631
667
  static get serverAudioRed(): boolean;
@@ -635,4 +671,6 @@ export default abstract class Params {
635
671
  static get filterObservers(): boolean;
636
672
  static get muteMode(): boolean;
637
673
  static get preserveAudioTracks(): boolean;
674
+ static get audioShareCapabilityEnabled(): boolean;
675
+ static get screenShareCongestionControl(): boolean;
638
676
  }
@@ -0,0 +1,6 @@
1
+ export declare const fromEntries: {
2
+ <T = any>(entries: Iterable<readonly [PropertyKey, T]>): {
3
+ [k: string]: T;
4
+ };
5
+ (entries: Iterable<readonly any[]>): any;
6
+ };
@@ -66,7 +66,7 @@ declare namespace WebRTCUtils {
66
66
  /**
67
67
  * Запрашивает трансляцию экрана пользователя
68
68
  */
69
- function getScreenMedia(): Promise<MediaStream>;
69
+ function getScreenMedia(withAudioShare: boolean): Promise<MediaStream>;
70
70
  /**
71
71
  * Запрашивает камеру пользователя
72
72
  *
@@ -146,5 +146,6 @@ declare namespace WebRTCUtils {
146
146
  * Возвращает подверсию браузера (если она есть)
147
147
  */
148
148
  function browserSubVersion(): string;
149
+ function isAudioShareSupported(): boolean;
149
150
  }
150
151
  export default WebRTCUtils;
package/types/Asr.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { ParticipantId } from './Participant';
2
+ export interface AsrInfo {
3
+ movieId: number;
4
+ initiatorId: ParticipantId;
5
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationFeature from '../enums/ConversationFeature';
2
+ import UserRole from '../enums/UserRole';
3
+ export declare type IFeaturesPerRole = Partial<Record<ConversationFeature, UserRole[]>>;
@@ -0,0 +1,22 @@
1
+ import { CompositeUserId } from './Participant';
2
+ import { ExternalParticipantId } from './ExternalId';
3
+ interface IFeedbackItem {
4
+ participantId: CompositeUserId;
5
+ /** event timestamps for this participant, chronologically */
6
+ times: number[];
7
+ }
8
+ export interface IFeedbackItemExternal extends Omit<IFeedbackItem, 'participantId'> {
9
+ participantId: ExternalParticipantId;
10
+ }
11
+ export interface IFeedback {
12
+ /** feedback ID; key values should be negotiated by clients themselves, like in ParticipantState, and have just the same restrictions; on backend the values of these keys are not bound in any way to those in ParticipantState */
13
+ key: string;
14
+ /** total amount of reactions of this type from the start of this call */
15
+ totalCount: number;
16
+ /** list of items containing initiator & all related data, if any */
17
+ items: IFeedbackItem[];
18
+ }
19
+ export interface IFeedbackExternal extends Omit<IFeedback, 'items'> {
20
+ items: IFeedbackItemExternal[];
21
+ }
22
+ export {};
@@ -14,6 +14,10 @@ export declare type MediaSettings = {
14
14
  * Включена ли трансляция экрана
15
15
  */
16
16
  isScreenSharingEnabled: boolean;
17
+ /**
18
+ * Включена ли трансляция звука
19
+ */
20
+ isAudioSharingEnabled: boolean;
17
21
  videoStreams: VideoStreamInfo[];
18
22
  };
19
23
  export declare type VideoStreamInfo = {
@@ -1,3 +1,4 @@
1
+ import LiveStatus from '../enums/LiveStatus';
1
2
  import { OkUserId, CompositeUserId } from './Participant';
2
3
  import { MediaType } from './ParticipantStreamDescription';
3
4
  export interface IMoviePreview {
@@ -13,13 +14,28 @@ export interface IAddMovieParams {
13
14
  thumbnails?: IMoviePreview[];
14
15
  };
15
16
  }
16
- export declare type ISharedMovieStateResponse = [number, number, boolean, number, number];
17
+ export declare type ISharedMovieStateResponse = [
18
+ number,
19
+ number,
20
+ boolean,
21
+ number,
22
+ boolean,
23
+ number
24
+ ];
17
25
  export interface ISharedMovieState {
18
26
  participantId: CompositeUserId;
19
27
  gain?: number;
20
28
  pause?: boolean;
21
29
  offset?: number;
22
- duration?: number;
30
+ mute?: boolean;
31
+ liveStatus?: LiveStatus;
32
+ }
33
+ export interface IUpdateMovieData {
34
+ movieId: string;
35
+ gain?: number;
36
+ pause?: boolean;
37
+ offset?: number;
38
+ mute?: boolean;
23
39
  }
24
40
  export interface ISharedMovieInfo {
25
41
  movieId: OkUserId;
@@ -57,6 +57,7 @@ export interface Participant {
57
57
  observedIds: CompositeUserId[];
58
58
  markers?: ExternalParticipantListMarkers;
59
59
  movieShareInfos?: ISharedMovieInfo[];
60
+ isInRoom?: boolean;
60
61
  }
61
62
  export interface IGetParticipantsParameters {
62
63
  externalIds: ExternalId[];
@@ -10,4 +10,6 @@ export interface ParticipantListChunkParameters {
10
10
  backward?: boolean;
11
11
  /** If true then resulting chunk will start from Participant with specified marker, if such Participant (still) exists */
12
12
  includeMarker?: boolean;
13
+ /** optional, id of the room to get chunk for, main call if unspecified */
14
+ roomId?: number;
13
15
  }
@@ -6,7 +6,8 @@ export declare enum MediaType {
6
6
  CAMERA = "CAMERA",
7
7
  SCREEN = "SCREEN",
8
8
  STREAM = "STREAM",
9
- MOVIE = "MOVIE"
9
+ MOVIE = "MOVIE",
10
+ AUDIOSHARE = "AUDIOSHARE"
10
11
  }
11
12
  export declare function serializeParticipantStreamDescription(description: ParticipantStreamDescription): string;
12
13
  export declare function parseParticipantStreamDescription(descriptionString: string): ParticipantStreamDescription;
package/types/Room.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ExternalParticipantId, ExternalParticipantListChunk } from './ExternalId';
2
- import { Participant, ParticipantListMarkers } from './Participant';
1
+ import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from './ExternalId';
2
+ import { ParticipantListMarkers } from './Participant';
3
3
  export interface Room {
4
4
  id: number;
5
5
  /**
@@ -33,9 +33,20 @@ export interface Room {
33
33
  */
34
34
  active?: boolean;
35
35
  }
36
+ /**
37
+ * Initial rooms state
38
+ */
39
+ export interface Rooms {
40
+ rooms: Room[];
41
+ /**
42
+ * current room id of participant. if null then the partipant is in the main call
43
+ */
44
+ roomId?: number;
45
+ }
36
46
  export interface RoomsUpdate {
37
47
  rooms?: Room[];
38
48
  roomIds?: number[];
49
+ deactivated?: boolean;
39
50
  }
40
51
  export interface RoomParticipantUpdate {
41
52
  roomId: number;
@@ -51,10 +62,11 @@ export interface RoomParticipantUpdate {
51
62
  /**
52
63
  * optional, data for added participants
53
64
  */
54
- addedParticipants?: Participant[];
65
+ addedParticipants?: ExternalParticipant[];
55
66
  /**
56
67
  * optional, depending on the context may contain either markers
57
68
  * for all (sorted) lists available or be empty (if client fails to support chunked participants)
58
69
  */
59
- removedParticipantMarkers?: ParticipantListMarkers;
70
+ removedParticipantMarkers?: ParticipantListMarkers[];
71
+ removedParticipantIds?: ExternalParticipantId[];
60
72
  }
@@ -8,6 +8,9 @@ import ParticipantState from '../enums/ParticipantState';
8
8
  import RoomsEventType from '../enums/RoomsEventType';
9
9
  import UserRole from '../enums/UserRole';
10
10
  import UserType from '../enums/UserType';
11
+ import { IFeaturesPerRole } from './ConversationFeature';
12
+ import { IFeedback } from './Feedback';
13
+ import { AsrInfo } from './Asr';
11
14
  import MediaModifiers from './MediaModifiers';
12
15
  import MediaSettings from './MediaSettings';
13
16
  import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
@@ -75,7 +78,7 @@ declare namespace SignalingMessage {
75
78
  multichatId: string | null;
76
79
  tamtamMultichatId: string | null;
77
80
  recordInfo: RecordInfo | null;
78
- featuresPerRole?: Partial<Record<ConversationFeature, UserRole[]>> | null;
81
+ featuresPerRole?: IFeaturesPerRole | null;
79
82
  pinnedParticipantId: ParticipantId | null;
80
83
  options: ConversationOption[];
81
84
  muteStates?: MuteStates;
@@ -89,6 +92,8 @@ declare namespace SignalingMessage {
89
92
  removeParticipantIds?: CompositeUserId[];
90
93
  participants?: ParticipantListChunk;
91
94
  active?: boolean;
95
+ countdownSec?: number;
96
+ timeoutMs?: number;
92
97
  }
93
98
  interface Notification extends SignalingMessage {
94
99
  type?: string;
@@ -200,7 +205,7 @@ declare namespace SignalingMessage {
200
205
  }
201
206
  export interface FeatureSetChanged extends Notification {
202
207
  features: ConversationFeature[];
203
- featuresPerRole?: Partial<Record<ConversationFeature, UserRole[]>> | null;
208
+ featuresPerRole?: IFeaturesPerRole | null;
204
209
  }
205
210
  export interface MultipartyChatCreated extends Notification {
206
211
  chatId: string;
@@ -292,11 +297,15 @@ declare namespace SignalingMessage {
292
297
  chatRoom?: ChatRoom;
293
298
  rooms?: {
294
299
  rooms: Room[];
300
+ roomId?: number;
295
301
  };
296
302
  }
297
303
  export interface JoinLinkChanged extends Notification {
298
304
  joinLink: string;
299
305
  }
306
+ export interface Feedback extends Notification {
307
+ feedback: IFeedback[];
308
+ }
300
309
  export interface SharedMovieState extends Notification {
301
310
  data: ISharedMovieState[];
302
311
  }
@@ -309,6 +318,7 @@ declare namespace SignalingMessage {
309
318
  updates: Partial<Record<RoomsEventType, {
310
319
  rooms?: Room;
311
320
  roomIds?: number[];
321
+ deactivated?: boolean;
312
322
  }>>;
313
323
  }
314
324
  export interface RoomUpdated extends Notification {
@@ -322,7 +332,16 @@ declare namespace SignalingMessage {
322
332
  participantCount: number;
323
333
  addedParticipantIds?: CompositeUserId[];
324
334
  addedParticipants?: Participant[];
325
- removedParticipantMarkers?: ParticipantListMarkers;
335
+ removedParticipantMarkers?: ParticipantListMarkers[];
336
+ }
337
+ export interface FeaturesPerRoleChanged extends Notification {
338
+ featuresPerRole?: IFeaturesPerRole | null;
339
+ }
340
+ export interface AsrStarted extends Notification {
341
+ asrInfo: AsrInfo;
342
+ }
343
+ export interface AsrStopped extends Notification {
344
+ movieId: number;
326
345
  }
327
346
  export {};
328
347
  }
@@ -1,6 +1,7 @@
1
1
  import { ExternalId } from './ExternalId';
2
2
  import { CompositeUserId } from './Participant';
3
3
  import SignalingMessage from './SignalingMessage';
4
+ import { IFeedback } from './Feedback';
4
5
  export declare type WaitingParticipantId = {
5
6
  addedTs: number;
6
7
  id: CompositeUserId;
@@ -9,18 +10,11 @@ export declare type WaitingParticipant = {
9
10
  id: WaitingParticipantId;
10
11
  externalId?: SignalingMessage.ExternalId;
11
12
  };
12
- export declare type Feedback = {
13
- key: string;
14
- totalCount: number;
15
- currentCount: number;
16
- timeout: number;
17
- participantIds: CompositeUserId[];
18
- };
19
13
  export declare type ChatRoom = {
20
14
  totalCount: number;
21
15
  firstParticipants?: WaitingParticipant[];
22
16
  handCount?: number;
23
- feedback?: Feedback[];
17
+ feedback?: IFeedback[];
24
18
  };
25
19
  /**
26
20
  * Ответ на запрос `getWaitingHall`
@@ -0,0 +1,24 @@
1
+ export declare class ArrayDequeue<T = any> {
2
+ /** очередь */
3
+ private readonly _queue;
4
+ /** курсор для чтения */
5
+ private _readCursor;
6
+ /** курсор для записи */
7
+ private _writeCursor;
8
+ /** подвинуть курсор чтения */
9
+ private _moveReadCursor;
10
+ /** сколько осталось в очереди элементов */
11
+ private _left;
12
+ constructor(length: number);
13
+ /** возвращает длину, переданную в конструктор */
14
+ get length(): number;
15
+ /** возвращает текущую длину очереди */
16
+ get left(): number;
17
+ toArray(): T[];
18
+ /** добавить элемент в очередь */
19
+ add(element: T): void;
20
+ /** вычисляет значение след курсора по кругу */
21
+ private nextCursor;
22
+ /** получить следующий элемент */
23
+ next(): T | null;
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
1
  /// <reference lib="webworker" />
2
2
  import type libvpx from '@vkontakte/libvpx';
3
- declare const _default: (vpx: typeof libvpx, urlResolver: (url: string) => string) => void;
3
+ declare const _default: (vpx: typeof libvpx, urlResolver: (url: string) => string, useCongestionControl: boolean, maxBitrate: number) => void;
4
4
  export default _default;