@vkontakte/calls-sdk 2.6.2-dev.abf49ca.0 → 2.6.2-dev.b9340ca.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 (47) hide show
  1. package/CallsSDK.d.ts +67 -14
  2. package/abstract/BaseApi.d.ts +7 -3
  3. package/abstract/BaseSignaling.d.ts +14 -3
  4. package/calls-sdk.cjs.js +8 -8
  5. package/calls-sdk.esm.js +8 -8
  6. package/classes/Conversation.d.ts +31 -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 +7 -3
  21. package/default/Signaling.d.ts +14 -3
  22. package/enums/ConversationFeature.d.ts +2 -1
  23. package/enums/ConversationOption.d.ts +2 -1
  24. package/enums/LiveStatus.d.ts +7 -0
  25. package/enums/MediaOption.d.ts +3 -1
  26. package/enums/RoomsEventType.d.ts +6 -0
  27. package/enums/SignalingCommandType.d.ts +12 -1
  28. package/enums/SignalingNotification.d.ts +8 -1
  29. package/package.json +1 -1
  30. package/static/External.d.ts +35 -1
  31. package/static/Params.d.ts +50 -1
  32. package/static/Polyfills.d.ts +6 -0
  33. package/static/WebRTCUtils.d.ts +2 -1
  34. package/types/Asr.d.ts +5 -0
  35. package/types/ConversationFeature.d.ts +3 -0
  36. package/types/Feedback.d.ts +22 -0
  37. package/types/MediaSettings.d.ts +4 -0
  38. package/types/MovieShare.d.ts +18 -2
  39. package/types/Participant.d.ts +1 -0
  40. package/types/ParticipantListChunk.d.ts +2 -0
  41. package/types/ParticipantStreamDescription.d.ts +2 -1
  42. package/types/Room.d.ts +72 -0
  43. package/types/SignalingMessage.d.ts +54 -0
  44. package/types/WaitingHall.d.ts +2 -8
  45. package/utils/ArrayDequeue.d.ts +24 -0
  46. package/utils/ArrayDequeue.spec.d.ts +1 -0
  47. package/worker/LibVPxEncoderWorker.d.ts +1 -1
@@ -6,14 +6,18 @@ import ChatRoomEventType from '../enums/ChatRoomEventType';
6
6
  import ConversationOption from '../enums/ConversationOption';
7
7
  import FatalError from '../enums/FatalError';
8
8
  import MediaOption from '../enums/MediaOption';
9
+ import RoomsEventType from '../enums/RoomsEventType';
9
10
  import UserRole from '../enums/UserRole';
11
+ import { IFeaturesPerRole } from '../types/ConversationFeature';
10
12
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalParticipantListMarkers } from '../types/ExternalId';
13
+ import { IFeedbackExternal } from '../types/Feedback';
11
14
  import IceServer from '../types/IceServer';
12
15
  import MediaModifiers from '../types/MediaModifiers';
13
16
  import MediaSettings from '../types/MediaSettings';
14
17
  import { IOnRemoteMovieData, ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from '../types/MovieShare';
15
18
  import MuteStates from '../types/MuteStates';
16
19
  import { ParticipantStateMapped } from '../types/Participant';
20
+ import { Room, RoomParticipantUpdate, Rooms, RoomsUpdate } from '../types/Room';
17
21
  import AuthData from './AuthData';
18
22
  import { DebugMessageType } from './Debug';
19
23
  import { ParticipantStatus } from './External';
@@ -237,6 +241,10 @@ export declare type ParamsObject = {
237
241
  * Включить постраничный вывод участников. Работает только если включено videoTracksCount (слоты)
238
242
  */
239
243
  useParticipantListChunk: boolean;
244
+ /**
245
+ * Включить комнаты
246
+ */
247
+ useRooms: boolean;
240
248
  /**
241
249
  * Индекс участника для первого chunk'а который придет при установки соединения с сервером
242
250
  */
@@ -282,6 +290,11 @@ export declare type ParamsObject = {
282
290
  * @hidden
283
291
  */
284
292
  preserveAudioTracks: boolean;
293
+ /**
294
+ * Использовать congestion control для шаринга
295
+ * @hidden
296
+ */
297
+ screenShareCongestionControl: boolean;
285
298
  /**
286
299
  * Получен локальный стрим с камеры/микрофона
287
300
  */
@@ -329,7 +342,7 @@ export declare type ParamsObject = {
329
342
  /**
330
343
  * Начат звонок
331
344
  */
332
- onConversation?: (userId: ExternalParticipantId, mediaModifiers: MediaModifiers, muteStates: MuteStates, participants?: ExternalParticipant[]) => void;
345
+ onConversation?: (userId: ExternalParticipantId, mediaModifiers: MediaModifiers, muteStates: MuteStates, participants?: ExternalParticipant[], rooms?: Rooms) => void;
333
346
  /**
334
347
  * Начальный список участников для постраничного звонка
335
348
  */
@@ -523,6 +536,39 @@ export declare type ParamsObject = {
523
536
  * @param joinLink токен присоединения к звонку
524
537
  */
525
538
  onJoinLinkChanged?: (joinLink: string) => void;
539
+ /**
540
+ * Получено обновление списка комнат
541
+ * @param updates список обновлений по комнатам
542
+ */
543
+ onRoomsUpdated?: (updates: Partial<Record<RoomsEventType, RoomsUpdate>>) => void;
544
+ /**
545
+ * Получено обновление комнаты
546
+ * @param eventTypes список событий
547
+ * @param roomId номер комнаты
548
+ * @param room комната
549
+ */
550
+ onRoomUpdated?: (eventTypes: RoomsEventType[], roomId: number, room: Room | null, deactivate: boolean | null) => void;
551
+ /**
552
+ * Получение обновление списка участников в комнате
553
+ * @param update обновление списка участников
554
+ */
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;
526
572
  };
527
573
  export default abstract class Params {
528
574
  private static _params;
@@ -615,6 +661,7 @@ export default abstract class Params {
615
661
  static get breakVideoPayloadTypes(): boolean;
616
662
  static get filteredMessages(): boolean;
617
663
  static get useParticipantListChunk(): boolean;
664
+ static get useRooms(): boolean;
618
665
  static get participantListChunkInitIndex(): number;
619
666
  static get participantListChunkInitCount(): number;
620
667
  static get serverAudioRed(): boolean;
@@ -624,4 +671,6 @@ export default abstract class Params {
624
671
  static get filterObservers(): boolean;
625
672
  static get muteMode(): boolean;
626
673
  static get preserveAudioTracks(): boolean;
674
+ static get audioShareCapabilityEnabled(): boolean;
675
+ static get screenShareCongestionControl(): boolean;
627
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;
@@ -0,0 +1,72 @@
1
+ import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from './ExternalId';
2
+ import { ParticipantListMarkers } from './Participant';
3
+ export interface Room {
4
+ id: number;
5
+ /**
6
+ * name of this room
7
+ */
8
+ name: string;
9
+ /**
10
+ * count of participants (read/write, optional)
11
+ */
12
+ participantCount: number;
13
+ /**
14
+ * ids of all participants (read/write, optional)
15
+ */
16
+ participantIds: ExternalParticipantId[];
17
+ /**
18
+ * ids of participants to be added to this room (read/write, optional)
19
+ */
20
+ addParticipantIds?: ExternalParticipantId[];
21
+ /**
22
+ * ids of participants to be removed from this room (read/write, optional)
23
+ */
24
+ removeParticipantIds?: ExternalParticipantId[];
25
+ /**
26
+ * if participant requested then contains first chunk of participants in this rooms
27
+ * (if client fails to support chunks, then contains all participant in this room)
28
+ * (read, optional)
29
+ */
30
+ participants?: ExternalParticipantListChunk;
31
+ /**
32
+ * if this room is active (read/write, optional)
33
+ */
34
+ active?: boolean;
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
+ }
46
+ export interface RoomsUpdate {
47
+ rooms?: Room[];
48
+ roomIds?: number[];
49
+ deactivated?: boolean;
50
+ }
51
+ export interface RoomParticipantUpdate {
52
+ roomId: number;
53
+ /**
54
+ * total number of participants in the room
55
+ */
56
+ participantCount: number;
57
+ /**
58
+ * ids of added participants, always present (if any) so participants would be able
59
+ * to identify their presence in particular room
60
+ */
61
+ addedParticipantIds?: ExternalParticipantId[];
62
+ /**
63
+ * optional, data for added participants
64
+ */
65
+ addedParticipants?: ExternalParticipant[];
66
+ /**
67
+ * optional, depending on the context may contain either markers
68
+ * for all (sorted) lists available or be empty (if client fails to support chunked participants)
69
+ */
70
+ removedParticipantMarkers?: ParticipantListMarkers[];
71
+ removedParticipantIds?: ExternalParticipantId[];
72
+ }
@@ -5,8 +5,12 @@ import ConversationOption from '../enums/ConversationOption';
5
5
  import HangupType from '../enums/HangupType';
6
6
  import MediaOption from '../enums/MediaOption';
7
7
  import ParticipantState from '../enums/ParticipantState';
8
+ import RoomsEventType from '../enums/RoomsEventType';
8
9
  import UserRole from '../enums/UserRole';
9
10
  import UserType from '../enums/UserType';
11
+ import { IFeaturesPerRole } from './ConversationFeature';
12
+ import { IFeedback } from './Feedback';
13
+ import { AsrInfo } from './Asr';
10
14
  import MediaModifiers from './MediaModifiers';
11
15
  import MediaSettings from './MediaSettings';
12
16
  import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
@@ -74,10 +78,23 @@ declare namespace SignalingMessage {
74
78
  multichatId: string | null;
75
79
  tamtamMultichatId: string | null;
76
80
  recordInfo: RecordInfo | null;
81
+ featuresPerRole?: IFeaturesPerRole | null;
77
82
  pinnedParticipantId: ParticipantId | null;
78
83
  options: ConversationOption[];
79
84
  muteStates?: MuteStates;
80
85
  }
86
+ export interface Room extends SignalingMessage {
87
+ id?: number;
88
+ name?: string;
89
+ participantCount?: number;
90
+ participantIds?: CompositeUserId[];
91
+ addParticipantIds?: CompositeUserId[];
92
+ removeParticipantIds?: CompositeUserId[];
93
+ participants?: ParticipantListChunk;
94
+ active?: boolean;
95
+ countdownSec?: number;
96
+ timeoutMs?: number;
97
+ }
81
98
  interface Notification extends SignalingMessage {
82
99
  type?: string;
83
100
  notification?: string;
@@ -188,6 +205,7 @@ declare namespace SignalingMessage {
188
205
  }
189
206
  export interface FeatureSetChanged extends Notification {
190
207
  features: ConversationFeature[];
208
+ featuresPerRole?: IFeaturesPerRole | null;
191
209
  }
192
210
  export interface MultipartyChatCreated extends Notification {
193
211
  chatId: string;
@@ -277,10 +295,17 @@ declare namespace SignalingMessage {
277
295
  mediaModifiers: MediaModifiers;
278
296
  participants?: ParticipantListChunk;
279
297
  chatRoom?: ChatRoom;
298
+ rooms?: {
299
+ rooms: Room[];
300
+ roomId?: number;
301
+ };
280
302
  }
281
303
  export interface JoinLinkChanged extends Notification {
282
304
  joinLink: string;
283
305
  }
306
+ export interface Feedback extends Notification {
307
+ feedback: IFeedback[];
308
+ }
284
309
  export interface SharedMovieState extends Notification {
285
310
  data: ISharedMovieState[];
286
311
  }
@@ -289,6 +314,35 @@ declare namespace SignalingMessage {
289
314
  }
290
315
  export interface SharedMovieStoppedInfo extends Notification, ISharedMovieStoppedInfo {
291
316
  }
317
+ export interface RoomsUpdated extends Notification {
318
+ updates: Partial<Record<RoomsEventType, {
319
+ rooms?: Room;
320
+ roomIds?: number[];
321
+ deactivated?: boolean;
322
+ }>>;
323
+ }
324
+ export interface RoomUpdated extends Notification {
325
+ events: RoomsEventType[];
326
+ room?: Room;
327
+ roomId: number;
328
+ deactivate?: boolean;
329
+ }
330
+ export interface RoomParticipantsUpdated extends Notification {
331
+ roomId: number;
332
+ participantCount: number;
333
+ addedParticipantIds?: CompositeUserId[];
334
+ addedParticipants?: Participant[];
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;
345
+ }
292
346
  export {};
293
347
  }
294
348
  export default SignalingMessage;
@@ -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;