@vkontakte/calls-sdk 2.6.2-dev.8c5f377.0 → 2.6.2-dev.974887b.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.
@@ -203,8 +203,6 @@ export default class Conversation extends EventEmitter {
203
203
  private _stopStreaming;
204
204
  private _sendUpdateDisplayLayout;
205
205
  private _cleanupCooldownQueue;
206
- private static _isStopStreaming;
207
- private static _layoutToString;
208
206
  private _onParticipantSourcesUpdate;
209
207
  private _onParticipantPromoted;
210
208
  private _onChatRoomUpdated;
@@ -250,6 +248,7 @@ export default class Conversation extends EventEmitter {
250
248
  videoEffect(effect: IEffect | null): Promise<void>;
251
249
  getParticipants(parameters: IGetParticipantsParameters): Promise<ExternalParticipant[]>;
252
250
  getParticipantListChunk(participantListChunkParameters: ParticipantListChunkParameters): Promise<ExternalParticipantListChunk>;
251
+ private _getInitialParticiapntListChunk;
253
252
  private _onLocalMediaStreamChanged;
254
253
  private _onScreenSharingStatus;
255
254
  private _changeRemoteMediaSettings;
@@ -305,6 +304,7 @@ export default class Conversation extends EventEmitter {
305
304
  private _toggleJoinAvailability;
306
305
  private _updateDisplayLayoutFromCache;
307
306
  private _setParticipantsStatus;
307
+ private _onJoinLinkChanged;
308
308
  }
309
309
  export declare class UpdateDisplayLayoutError extends Error {
310
310
  readonly participantErrors: {
@@ -2,7 +2,9 @@ import { ParticipantStreamDescription } from '../types/ParticipantStreamDescript
2
2
  import SignalingMessage from '../types/SignalingMessage';
3
3
  export declare class ParticipantIdRegistry {
4
4
  private streamDescriptionByCompactId;
5
+ private compactIdByStreamDescription;
5
6
  getStreamDescription(compactedId: number): ParticipantStreamDescription | undefined;
7
+ getCompactId(streamDescription: string): number | undefined;
6
8
  handleMessage(data: ArrayBuffer): SignalingMessage | null;
7
9
  private _createParticipantSourcesUpdateNotification;
8
10
  }
@@ -0,0 +1,17 @@
1
+ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
2
+ import SignalingMessage from '../types/SignalingMessage';
3
+ import { ParticipantIdRegistry } from './ParticipantIdRegistry';
4
+ import { PerfStatReport } from './transport/PerfStatReporter';
5
+ export declare class ProducerCommandSerializationService {
6
+ private participantIdRegistry;
7
+ setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
8
+ serializeUpdateDisplayLayout(sequenceNumber: number, layouts: {
9
+ [key: string]: ParticipantLayout | StopStream | RequestKeyFrame;
10
+ }): ArrayBuffer;
11
+ private writeLayout;
12
+ private writeStreamDesc;
13
+ serializePerfStatReport(sequenceNumber: number, report: PerfStatReport): ArrayBuffer;
14
+ deserializeCommandResponse(data: BufferSource): SignalingMessage | undefined;
15
+ private deserializeUpdateDisplayLayoutResponse;
16
+ private deserializeReportPerfStatResponse;
17
+ }
@@ -3,6 +3,7 @@ export default class ScreenCaptureSender {
3
3
  private readonly _datachannel;
4
4
  private _destroyed;
5
5
  private _needKeyframe;
6
+ private readonly DATA_SIZE;
6
7
  constructor(track: MediaStreamTrack, datachannel: RTCDataChannel);
7
8
  private _requestFrame;
8
9
  private _wrapHeader;
@@ -1,3 +1,4 @@
1
+ export declare const HEADER_SIZE = 11;
1
2
  export interface FrameChunkHeader {
2
3
  timestamp: number;
3
4
  start: boolean;
@@ -13,6 +13,7 @@ import MediaModifiers from '../types/MediaModifiers';
13
13
  import MediaSettings from '../types/MediaSettings';
14
14
  import MuteStates from '../types/MuteStates';
15
15
  import { CompositeUserId, ParticipantId } from '../types/Participant';
16
+ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
16
17
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
17
18
  import SignalingMessage from '../types/SignalingMessage';
18
19
  import { WaitingParticipantId } from '../types/WaitingHall';
@@ -39,6 +40,8 @@ export default class Signaling extends BaseSignaling {
39
40
  private participantIdRegistry;
40
41
  private producerNotificationDataChannel;
41
42
  private producerCommandDataChannel;
43
+ private producerCommandDataChannelEnabled;
44
+ private producerCommandSerializationService;
42
45
  private static readonly RECONNECT_DELAY;
43
46
  private static readonly RECONNECT_MAX_DELAY;
44
47
  private static readonly RECONNECT_MAX_COUNT;
@@ -52,6 +55,7 @@ export default class Signaling extends BaseSignaling {
52
55
  setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
53
56
  setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
54
57
  setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
58
+ useCommandDataChannel(status: boolean): void;
55
59
  /**
56
60
  * Free used resources
57
61
  */
@@ -89,8 +93,8 @@ export default class Signaling extends BaseSignaling {
89
93
  changePriorities(priorities: {
90
94
  [key: string]: number;
91
95
  }): Promise<SignalingMessage | void>;
92
- updateDisplayLayout(layout: {
93
- [key: string]: string;
96
+ updateDisplayLayout(layouts: {
97
+ [streamDesc: string]: ParticipantLayout | StopStream | RequestKeyFrame;
94
98
  }): Promise<SignalingMessage>;
95
99
  addMovie(data: any): Promise<SignalingMessage>;
96
100
  updateMovie(data: any): Promise<SignalingMessage>;
@@ -140,6 +144,9 @@ export default class Signaling extends BaseSignaling {
140
144
  protected _reconnect(): void;
141
145
  private _handleCommandResponse;
142
146
  private _handleCommandsQueue;
147
+ private _serializeBinary;
148
+ private _serializeJson;
149
+ private _convertDisplayLayout;
143
150
  protected _waitConnectionMessage(): void;
144
151
  protected _stopWaitConnectionMessage(): void;
145
152
  private _startDoctor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.2-dev.8c5f377.0",
3
+ "version": "2.6.2-dev.974887b.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",
@@ -1,7 +1,7 @@
1
1
  export declare function init(): void;
2
2
  export declare function sendBeakon(method: string, params?: {
3
3
  [key: string]: any;
4
- }, noSession?: boolean): void;
4
+ }, noSession?: boolean): Promise<void>;
5
5
  export declare function request(method: string, params?: {
6
6
  [key: string]: any;
7
7
  }, noSession?: boolean): Promise<unknown>;
@@ -187,8 +187,10 @@ declare namespace External {
187
187
  * @param unmute Разрешение включить устройство
188
188
  * @param userId Пользователь, для которого изменились разрешения или `null` для текущего пользователя
189
189
  * @param adminId Пользователь, который изменил разрешения
190
+ * @param stateUpdated Если `true`, значит глобальное/персональное состояние изменилось и поля `muteStates`/`unmuteOptions` содержат обновления, если `false`, значит, эти поля не имеют значения
191
+ * @param requestedMedia Какие устройства попросили влючить участника
190
192
  */
191
- function onMuteStates(muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll?: boolean, unmute?: boolean, userId?: ExternalParticipantId | null, adminId?: ExternalParticipantId | null): void;
193
+ function onMuteStates(muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll?: boolean, unmute?: boolean, userId?: ExternalParticipantId | null, adminId?: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[]): void;
192
194
  /**
193
195
  * Изменились роли собеседника в звонке
194
196
  *
@@ -348,5 +350,10 @@ declare namespace External {
348
350
  * @param stream стрим от WebRTC
349
351
  */
350
352
  function onRemoteMixedAudioStream(stream: MediaStream): void;
353
+ /**
354
+ * Получена новая ссылка на звонок
355
+ * @param joinLink токен присоединения к звонку
356
+ */
357
+ function onJoinLinkChanged(joinLink: string): void;
351
358
  }
352
359
  export default External;
@@ -186,6 +186,7 @@ export declare type ParamsObject = {
186
186
  * Работает только при приёме экрана через дата-канал.
187
187
  *
188
188
  * _По умолчанию: `true`_
189
+ * @deprecated
189
190
  */
190
191
  producerScreenTrack: boolean;
191
192
  /**
@@ -193,12 +194,19 @@ export declare type ParamsObject = {
193
194
  * Работает только при отправке экрана через дата-канал.
194
195
  *
195
196
  * _По умолчанию: `true`_
197
+ * @deprecated
196
198
  */
197
199
  consumerScreenTrack: boolean;
198
200
  producerNotificationDataChannel: boolean;
199
201
  producerCommandDataChannel: boolean;
200
202
  consumerScreenDataChannel: boolean;
201
203
  producerScreenDataChannel: boolean;
204
+ /**
205
+ * Размер пакета для отправки трансляции экрана в датаканал в байтах.
206
+ * Максимальный размер пакета 65536 bytes в хроме, но по стандарту лучше максимум 16 Кб.
207
+ * @hidden
208
+ */
209
+ consumerScreenDataChannelPacketSize: number;
202
210
  screenShareWebmBuilder: boolean;
203
211
  noiseSuppression: boolean;
204
212
  /**
@@ -349,7 +357,7 @@ export declare type ParamsObject = {
349
357
  /**
350
358
  * Изменились состояния устройств пользователя или разрешения включать камеру/микрофон
351
359
  */
352
- onMuteStates?: (muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll: boolean, unmute: boolean, userId: ExternalParticipantId | null, adminId: ExternalParticipantId | null) => void;
360
+ onMuteStates?: (muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll: boolean, unmute: boolean, userId: ExternalParticipantId | null, adminId: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[]) => void;
353
361
  /**
354
362
  * Изменились роли собеседника в звонке
355
363
  */
@@ -465,6 +473,11 @@ export declare type ParamsObject = {
465
473
  * @param stream стрим от WebRTC
466
474
  */
467
475
  onRemoteMixedAudioStream?: (stream: MediaStream) => void;
476
+ /**
477
+ * Получена новая ссылка на звонок
478
+ * @param joinLink токен присоединения к звонку
479
+ */
480
+ onJoinLinkChanged?: (joinLink: string) => void;
468
481
  };
469
482
  export default abstract class Params {
470
483
  private static _params;
@@ -474,7 +487,7 @@ export default abstract class Params {
474
487
  static get(name: string): any;
475
488
  static get appName(): string;
476
489
  static get appVersion(): number;
477
- static get sdkVersion(): string | number | boolean;
490
+ static get sdkVersion(): string;
478
491
  static get debug(): string | number | boolean;
479
492
  static get protocolVersion(): 5 | 6;
480
493
  static get platform(): string;
@@ -539,6 +552,7 @@ export default abstract class Params {
539
552
  static get producerCommandDataChannel(): boolean;
540
553
  static get consumerScreenDataChannel(): boolean;
541
554
  static get producerScreenDataChannel(): boolean;
555
+ static get consumerScreenDataChannelPacketSize(): number;
542
556
  static get screenShareWebmBuilder(): boolean;
543
557
  static get noiseSuppression(): boolean;
544
558
  static set noiseSuppression(value: boolean);
package/static/Utils.d.ts CHANGED
@@ -60,5 +60,7 @@ declare namespace Utils {
60
60
  * https://stash.odkl.ru/projects/ODKL/repos/odnoklassniki-webrtc/browse/src/main/java/one/webrtc/domain/conversation/ParticipantIndex.java#67-78
61
61
  */
62
62
  function participantMarkerCompare(marker1: ExternalParticipantListMarker | undefined, marker2: ExternalParticipantListMarker | undefined): number;
63
+ /** убирает все ключи со значением `V` на 1 уровне */
64
+ function objectFilterOutValues<T extends Record<string, V>, V = unknown>(obj: T, value?: V | V[]): Partial<T>;
63
65
  }
64
66
  export default Utils;
@@ -0,0 +1,5 @@
1
+ import { Layout, RequestKeyFrame, StopStream } from './ParticipantLayout';
2
+ export declare const REQUEST_KEY_FRAME_CODE = "kf";
3
+ export declare function isStopStreaming(layout: Layout | StopStream | RequestKeyFrame): layout is StopStream;
4
+ export declare function isRequestKeyFrame(layout: Layout | StopStream | RequestKeyFrame): layout is RequestKeyFrame;
5
+ export declare function layoutToString(layout: Layout | StopStream | RequestKeyFrame): string;
@@ -31,10 +31,16 @@ export declare type StopStream = {
31
31
  */
32
32
  stopStream: true;
33
33
  };
34
+ /**
35
+ * Request key frame from source. Should not be called often, negatively impacts video quality.
36
+ */
37
+ export declare type RequestKeyFrame = {
38
+ keyFrameRequested: true;
39
+ };
34
40
  /**
35
41
  * Лейаут собеседника в звонке
36
42
  */
37
- export declare type ParticipantLayout = (Layout | StopStream) & {
43
+ export declare type ParticipantLayout = (Layout | StopStream | RequestKeyFrame) & {
38
44
  /**
39
45
  * Внешний ID пользователя
40
46
  */
@@ -148,6 +148,8 @@ declare namespace SignalingMessage {
148
148
  muteStates: MuteStates;
149
149
  unmuteOptions?: MediaOption[];
150
150
  mediaOptions: MediaOption[];
151
+ requestedMedia?: MediaOption[];
152
+ stateUpdated?: boolean;
151
153
  unmute?: boolean;
152
154
  muteAll?: boolean;
153
155
  }
@@ -240,6 +242,7 @@ declare namespace SignalingMessage {
240
242
  demote: boolean;
241
243
  mediaModifiers: MediaModifiers;
242
244
  conversation: Conversation;
245
+ participants?: ParticipantListChunk;
243
246
  }
244
247
  export interface ChatRoomUpdated extends Notification {
245
248
  eventType: ChatRoomEventType;
@@ -273,6 +276,9 @@ declare namespace SignalingMessage {
273
276
  participants?: ParticipantListChunk;
274
277
  chatRoom?: ChatRoom;
275
278
  }
279
+ export interface JoinLinkChanged extends Notification {
280
+ joinLink: string;
281
+ }
276
282
  export {};
277
283
  }
278
284
  export default SignalingMessage;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Fork from messagepack internals.
3
+ * Package messagepack doesn't export createWriteBuffer and createReadBuffer methods.
4
+ */
5
+ export declare function createWriteBuffer(): {
6
+ put(v: BufferSource): void;
7
+ putI8(v: number): void;
8
+ putI16(v: number): void;
9
+ putI32(v: number): void;
10
+ putI64(v: number): void;
11
+ putUi8(v: number): void;
12
+ putUi16(v: number): void;
13
+ putUi32(v: number): void;
14
+ putUi64(v: number): void;
15
+ putF(v: number): void;
16
+ ui8array(): Uint8Array;
17
+ };
18
+ export declare function createReadBuffer(buf: BufferSource): {
19
+ peek(): number;
20
+ get(len: number): ArrayBuffer;
21
+ getI8(): number;
22
+ getI16(): number;
23
+ getI32(): number;
24
+ getI64(): number;
25
+ getUi8(): number;
26
+ getUi16(): number;
27
+ getUi32(): number;
28
+ getUi64(): number;
29
+ getF32(): number;
30
+ getF64(): number;
31
+ };