@vkontakte/calls-sdk 2.6.2-dev.abaf7cc.0 → 2.6.2-dev.ac5839e.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.
@@ -50,7 +50,7 @@ export declare type ConversationData = {
50
50
  direction: CallDirection;
51
51
  concurrent: boolean;
52
52
  needRate: boolean;
53
- recordInfo: RecordInfo | null;
53
+ recordsInfo: Record<number, RecordInfo | null>;
54
54
  chatId: string | null;
55
55
  asrInfo: AsrInfo | null;
56
56
  /**
@@ -180,6 +180,13 @@ export default class Conversation extends EventEmitter {
180
180
  * @hidden
181
181
  */
182
182
  private _processConnectionData;
183
+ /**
184
+ * Обрабатывает информацию о записи/трансляции в основном и сессионных залах
185
+ * @param connection
186
+ * @private
187
+ * @hidden
188
+ */
189
+ private _processRecordInfos;
183
190
  private _allocateTransport;
184
191
  private _createSpeakerDetector;
185
192
  private _createSpecListener;
@@ -232,7 +239,7 @@ export default class Conversation extends EventEmitter {
232
239
  grantRoles(participantId: CompositeUserId, roles: UserRole[], revoke: boolean): Promise<void>;
233
240
  startAsr(): Promise<void>;
234
241
  stopAsr(): Promise<void>;
235
- muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia?: MediaOption[]): Promise<void>;
242
+ muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia?: MediaOption[], roomId?: number): Promise<void>;
236
243
  enableFeatureForRoles(feature: ConversationFeature, roles: UserRole[]): Promise<void>;
237
244
  pinParticipant(participantId: ParticipantId, unpin: boolean): Promise<void>;
238
245
  updateMediaModifiers(mediaModifiers: MediaModifiers): Promise<void>;
@@ -260,9 +267,9 @@ export default class Conversation extends EventEmitter {
260
267
  activateRooms(roomIds: number[], deactivate: boolean): Promise<void>;
261
268
  switchRoom(toRoomId?: number, participantId?: ParticipantId): Promise<void>;
262
269
  removeRooms(roomIds: number[]): Promise<void>;
263
- startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null): Promise<SignalingMessage>;
264
- stopStream(): Promise<SignalingMessage>;
265
- recordSetRole(participantId: ParticipantId, role: RecordRole | null): Promise<void>;
270
+ startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null, roomId?: number | null): Promise<SignalingMessage>;
271
+ stopStream(roomId?: number | null): Promise<SignalingMessage>;
272
+ recordSetRole(participantId: ParticipantId, role: RecordRole | null, roomId?: number | null): Promise<void>;
266
273
  getStreamInfo(): Promise<{
267
274
  movieId: any;
268
275
  preview: any;
@@ -300,12 +307,14 @@ export default class Conversation extends EventEmitter {
300
307
  private _onChatMessage;
301
308
  private _onCustomData;
302
309
  private _onRecordInfo;
310
+ changeRecordInfoForRoom(roomId?: number): Promise<void>;
303
311
  private _onAsrInfo;
304
312
  private _onRolesChanged;
305
313
  /**
306
314
  * Клиент должен немедленно выключить микрофон и/или камеру
307
315
  */
308
316
  private _onMuteParticipant;
317
+ applyMuteStates(muteStates: MuteStates, mediaOptions: MediaOption[], roomId?: number): void;
309
318
  private _processMuteState;
310
319
  private _onPinParticipant;
311
320
  private _onOptionsChanged;
@@ -1,6 +1,6 @@
1
1
  import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
2
2
  import SignalingMessage from '../types/SignalingMessage';
3
- import { SharingStatReport } from '../classes/screenshare/SharingStatReport';
3
+ import { SharingStatReport } from './screenshare/SharingStatReport';
4
4
  import { ParticipantIdRegistry } from './ParticipantIdRegistry';
5
5
  import { PerfStatReport } from './transport/PerfStatReporter';
6
6
  export declare class ProducerCommandSerializationService {
@@ -76,6 +76,5 @@ export default class ServerTransport extends EventEmitter {
76
76
  static _onSignalingStateChange(pc: RTCPeerConnection, event: any): void;
77
77
  private _onConnectionStateChange;
78
78
  private _onReplacedTrack;
79
- private static _isUnifiedPlanSupported;
80
79
  getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
81
80
  }
@@ -107,8 +107,8 @@ export default class Signaling extends BaseSignaling {
107
107
  switchRoom(toRoomId?: number, participantId?: ParticipantId): Promise<SignalingMessage>;
108
108
  removeRooms(roomIds: number[]): Promise<SignalingMessage>;
109
109
  startStream(data: any): Promise<SignalingMessage>;
110
- stopStream(): Promise<SignalingMessage>;
111
- recordSetRole(participantId: ParticipantId, role: RecordRole | null): Promise<SignalingMessage>;
110
+ stopStream(data: any): Promise<SignalingMessage>;
111
+ recordSetRole(participantId: ParticipantId, role: RecordRole | null, roomId: number | null): Promise<SignalingMessage>;
112
112
  getRecordStatus(): Promise<SignalingMessage>;
113
113
  switchTopology(topology: TransportTopology, force?: boolean): Promise<SignalingMessage>;
114
114
  requestRealloc(): Promise<SignalingMessage>;
@@ -118,7 +118,7 @@ export default class Signaling extends BaseSignaling {
118
118
  chatHistory(count: number): Promise<SignalingMessage>;
119
119
  customData(data: JSONObject, participantId: ParticipantId | null): Promise<SignalingMessage>;
120
120
  grantRoles(participantId: CompositeUserId, roles: UserRole[], revoke: boolean): Promise<SignalingMessage>;
121
- muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia: MediaOption[]): Promise<SignalingMessage>;
121
+ muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia: MediaOption[], roomId?: number): Promise<SignalingMessage>;
122
122
  enableFeatureForRoles(feature: ConversationFeature, roles: UserRole[]): Promise<SignalingMessage>;
123
123
  pinParticipant(participantId: ParticipantId, unpin: boolean): Promise<SignalingMessage>;
124
124
  updateMediaModifiers(mediaModifiers: MediaModifiers): Promise<SignalingMessage>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.2-dev.abaf7cc.0",
3
+ "version": "2.6.2-dev.ac5839e.0",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -250,9 +250,10 @@ declare namespace External {
250
250
  * @param userId Пользователь, для которого изменились разрешения или `null` для текущего пользователя
251
251
  * @param adminId Пользователь, который изменил разрешения
252
252
  * @param stateUpdated Если `true`, значит глобальное/персональное состояние изменилось и поля `muteStates`/`unmuteOptions` содержат обновления, если `false`, значит, эти поля не имеют значения
253
- * @param requestedMedia Какие устройства попросили влючить участника
253
+ * @param requestedMedia Какие устройства попросили включить участника
254
+ * @param roomId ID сессионного зала или ничего в случае основного зала
254
255
  */
255
- function onMuteStates(muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll?: boolean, unmute?: boolean, userId?: ExternalParticipantId | null, adminId?: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[]): void;
256
+ function onMuteStates(muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll?: boolean, unmute?: boolean, userId?: ExternalParticipantId | null, adminId?: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[], roomId?: number): void;
256
257
  /**
257
258
  * Изменились роли собеседника в звонке
258
259
  *
@@ -359,12 +360,14 @@ declare namespace External {
359
360
  * @param type Тип записи
360
361
  * @param externalMovieId Внешний ID ролика
361
362
  * @param externalOwnerId Внешний ID пользователя/группы от которого ведётся трансляция
363
+ * @param roomId ID зала в котором стартанула запись
362
364
  */
363
- function onRecordStarted(initiator: ExternalParticipantId, movieId: number, startTime: number, type: 'STREAM' | 'RECORD', externalMovieId?: string, externalOwnerId?: string): void;
365
+ function onRecordStarted(initiator: ExternalParticipantId, movieId: number, startTime: number, type: 'STREAM' | 'RECORD', externalMovieId?: string, externalOwnerId?: string, roomId?: number): void;
364
366
  /**
365
367
  * Закончена запись звонка
368
+ * @param roomId ID зала в котором остановлена запись
366
369
  */
367
- function onRecordStopped(): void;
370
+ function onRecordStopped(roomId?: number): void;
368
371
  /**
369
372
  * Состояние своей сети
370
373
  *
@@ -175,9 +175,6 @@ export declare type ParamsObject = {
175
175
  };
176
176
  perfStatReportEnabled: boolean;
177
177
  callStatReportEnabled: boolean;
178
- unifiedPlanBrowsers: {
179
- [key: string]: number;
180
- };
181
178
  /**
182
179
  * Отдавать приоритет кодеку H264 для исходящего видео
183
180
  *
@@ -239,32 +236,44 @@ export declare type ParamsObject = {
239
236
  breakVideoPayloadTypes: boolean;
240
237
  /**
241
238
  * Включить постраничный вывод участников. Работает только если включено videoTracksCount (слоты)
239
+ *
240
+ * _По умолчанию: `false`_
242
241
  */
243
242
  useParticipantListChunk: boolean;
244
243
  /**
245
244
  * Включить комнаты
245
+ *
246
+ * _По умолчанию: `false`_
246
247
  */
247
248
  useRooms: boolean;
248
249
  /**
249
- * Индекс участника для первого chunk'а который придет при установки соединения с сервером
250
+ * Индекс участника для первого chunk'а который придет при установке соединения с сервером
251
+ *
252
+ * _По умолчанию: `0`_
250
253
  */
251
254
  participantListChunkInitIndex: number;
252
255
  /**
253
- * Количество участников которые придут в первом chunk'е при установки соединения с сервером
256
+ * Количество участников которые придут в первом chunk'е при установке соединения с сервером
254
257
  * если параметр не проставлен то будет использоваться значение по умолчанию установленное на сервере
255
258
  */
256
259
  participantListChunkInitCount: number | null;
257
260
  /**
258
261
  * Включать RED-extension (redundancy) для групповых звонков
262
+ *
263
+ * _По умолчанию: `false`_
259
264
  */
260
265
  serverAudioRed: boolean;
261
266
  /**
262
267
  * Включать RED-extension (redundancy) для p2p звонков
268
+ *
269
+ * _По умолчанию: `false`_
263
270
  */
264
271
  p2pAudioRed: boolean;
265
272
  /**
266
273
  * Добавлять флаг spsPpsIdrInKeyframe для h264 кодека. В результате ключевые фреймы без sps и pps
267
274
  * не используются как ключевые. Решает проблему с артефактами на видео в случае потерь пакетов.
275
+ *
276
+ * _По умолчанию: `false`_
268
277
  */
269
278
  h264spsPpsIdrInKeyframe: boolean;
270
279
  /**
@@ -415,7 +424,7 @@ export declare type ParamsObject = {
415
424
  /**
416
425
  * Изменились состояния устройств пользователя или разрешения включать камеру/микрофон
417
426
  */
418
- onMuteStates?: (muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll: boolean, unmute: boolean, userId: ExternalParticipantId | null, adminId: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[]) => void;
427
+ onMuteStates?: (muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll: boolean, unmute: boolean, userId: ExternalParticipantId | null, adminId: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[], roomId?: number) => void;
419
428
  /**
420
429
  * Изменились роли собеседника в звонке
421
430
  */
@@ -485,11 +494,11 @@ export declare type ParamsObject = {
485
494
  /**
486
495
  * Начата трансляция/запись звонка
487
496
  */
488
- onRecordStarted?: (initiator: ExternalParticipantId, movieId: number, startTime: number, type: 'STREAM' | 'RECORD', externalMovieId?: string, externalOwnerId?: string) => void;
497
+ onRecordStarted?: (initiator: ExternalParticipantId, movieId: number, startTime: number, type: 'STREAM' | 'RECORD', externalMovieId?: string, externalOwnerId?: string, roomId?: number) => void;
489
498
  /**
490
499
  * Закончена трансляция/запись звонка
491
500
  */
492
- onRecordStopped?: () => void;
501
+ onRecordStopped?: (roomId?: number) => void;
493
502
  /**
494
503
  * Состояние своей сети
495
504
  *
@@ -655,7 +664,6 @@ export default abstract class Params {
655
664
  static get audioNack(): boolean;
656
665
  static get consumerScreenTrack(): boolean;
657
666
  static get producerScreenTrack(): boolean;
658
- static isUnifiedPlanSupported(name: string, version: number): boolean;
659
667
  static get movieShare(): boolean;
660
668
  static get videoTracksCount(): number;
661
669
  static get breakVideoPayloadTypes(): boolean;
@@ -0,0 +1,7 @@
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
+ };
7
+ export declare function blobToArrayBuffer(data: Blob): Promise<ArrayBuffer>;
package/static/Utils.d.ts CHANGED
@@ -6,7 +6,8 @@ import VideoSettings from '../types/VideoSettings';
6
6
  export declare const PARAMETERS_SEPARATOR = ":";
7
7
  export declare const DEVICE_IDX_PARAMETER = "d";
8
8
  declare namespace Utils {
9
- function patchSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, h264spsPpsIdrInKeyframe: boolean, isAudioNack?: boolean, preferRed?: boolean): string;
9
+ function patchLocalSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, h264spsPpsIdrInKeyframe: boolean, isAudioNack?: boolean, preferRed?: boolean): string;
10
+ function patchRemoteSDP(sdp: string): string;
10
11
  function getPeerIdString(peerId: SignalingMessage.PeerId): string;
11
12
  function comparePeerId(peerId1: SignalingMessage.PeerId, peerId2: SignalingMessage.PeerId): boolean;
12
13
  function getPeerConnectionHostInfo(pc: RTCPeerConnection): Promise<any>;
@@ -10,6 +10,47 @@ export declare enum FacingMode {
10
10
  LEFT = "left",
11
11
  RIGHT = "right"
12
12
  }
13
+ /********************* MediaConstraints *********************/
14
+ /**
15
+ * Вспомогательный класс для формирования параметров, которые нужны для запроса камеры и микрофона.
16
+ * @hidden
17
+ */
18
+ declare class MediaConstraints {
19
+ protected audio: MediaTrackConstraints | boolean;
20
+ protected video: MediaTrackConstraints | boolean;
21
+ private readonly needVideo;
22
+ constructor(audioDeviceId: boolean | string, videoDeviceId?: boolean | string, videoMaxWidth?: number, videoMaxHeight?: number);
23
+ /**
24
+ * Возвращает нативные параметры для передачи в getUserMedia.
25
+ */
26
+ getNative(): object;
27
+ /**
28
+ * Метод упрощает параметры, чтобы попробовать сделать getUserMedia еще раз при ошибке.
29
+ * Сначала убираются размеры, потом соотношения сторон.
30
+ */
31
+ simplify(): MediaConstraints;
32
+ /**
33
+ * Проверяет, можно ли упростить параметры.
34
+ */
35
+ canSimplify(): boolean;
36
+ /**
37
+ * Проверяет, есть ли параметры видео.
38
+ */
39
+ isVideo(): boolean;
40
+ /**
41
+ * Проверяет, есть ли параметры аудио.
42
+ */
43
+ isAudio(): boolean;
44
+ }
45
+ /********************* /MediaConstraints *********************/
46
+ /********************* ScreenConstraints *********************/
47
+ /**
48
+ * Вспомогательный класс для формирования параметров, которые нужны для запроса трансляции экрана.
49
+ * @hidden
50
+ */
51
+ export declare class ScreenConstraints extends MediaConstraints {
52
+ constructor(width: number, height: number, withAudioShare: boolean);
53
+ }
13
54
  declare namespace WebRTCUtils {
14
55
  /**
15
56
  * Инициализирует устройства. До вызова этого метода бесполезно опрашивать другие публичные методы
@@ -64,7 +105,7 @@ declare namespace WebRTCUtils {
64
105
  */
65
106
  function getUserMedia(needVideo?: boolean, needAudio?: boolean, needEmptyTracks?: boolean): Promise<MediaStream>;
66
107
  /**
67
- * Запрашивает трансляцию экрана пользователя
108
+ * Запрашивает трансляцию экрана пользователя с опциональным захватом звука
68
109
  */
69
110
  function getScreenMedia(withAudioShare: boolean): Promise<MediaStream>;
70
111
  /**
@@ -100,15 +141,6 @@ declare namespace WebRTCUtils {
100
141
  * Проверяет поддержку шаринга экрана браузером
101
142
  */
102
143
  function isScreenCapturingSupported(): boolean;
103
- /**
104
- * Проверяет доступность кодека VP8 при использовании WebRTC.
105
- * Кодек может быть доступен, даже если видео VP8 в браузере не поддерживается.
106
- */
107
- function canVP8(): boolean;
108
- /**
109
- * Проверяет используемый план (unified-plan или plan-b)
110
- */
111
- function isUnifiedPlan(): boolean;
112
144
  /**
113
145
  * В некоторых браузерах H264 сломан
114
146
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -9,4 +9,5 @@ export interface IProcessMuteStateParams {
9
9
  admin?: Participant | null;
10
10
  stateUpdated?: boolean;
11
11
  requestedMedia?: MediaOption[];
12
+ roomId?: number;
12
13
  }
package/types/Room.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from './ExternalId';
2
+ import MuteStates from './MuteStates';
2
3
  import { ParticipantListMarkers } from './Participant';
3
4
  export interface Room {
4
5
  id: number;
@@ -32,6 +33,10 @@ export interface Room {
32
33
  * if this room is active (read/write, optional)
33
34
  */
34
35
  active?: boolean;
36
+ /**
37
+ * global (room-wide) mute state, if any
38
+ */
39
+ muteStates?: MuteStates;
35
40
  }
36
41
  /**
37
42
  * Initial rooms state
@@ -94,6 +94,8 @@ declare namespace SignalingMessage {
94
94
  active?: boolean;
95
95
  countdownSec?: number;
96
96
  timeoutMs?: number;
97
+ muteStates?: MuteStates;
98
+ recordInfo?: RecordInfo;
97
99
  }
98
100
  interface Notification extends SignalingMessage {
99
101
  type?: string;
@@ -171,6 +173,7 @@ declare namespace SignalingMessage {
171
173
  stateUpdated?: boolean;
172
174
  unmute?: boolean;
173
175
  muteAll?: boolean;
176
+ roomId?: number;
174
177
  }
175
178
  export interface PinParticipant extends Notification {
176
179
  participantId: ParticipantId;