@vkontakte/calls-sdk 2.6.2-dev.1d98360.0 → 2.6.2-dev.22f43ca.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.
@@ -151,6 +151,7 @@ export default class Conversation extends EventEmitter {
151
151
  private _processConnection;
152
152
  private _prepareParticipants;
153
153
  private _onConversationParticipantListChunk;
154
+ private _createParticipantListChunk;
154
155
  private _participantListChunkToExternalChunk;
155
156
  private _registerConnectionParticipants;
156
157
  private _registerParticipants;
@@ -203,8 +204,6 @@ export default class Conversation extends EventEmitter {
203
204
  private _stopStreaming;
204
205
  private _sendUpdateDisplayLayout;
205
206
  private _cleanupCooldownQueue;
206
- private static _isStopStreaming;
207
- private static _layoutToString;
208
207
  private _onParticipantSourcesUpdate;
209
208
  private _onParticipantPromoted;
210
209
  private _onChatRoomUpdated;
@@ -250,6 +249,7 @@ export default class Conversation extends EventEmitter {
250
249
  videoEffect(effect: IEffect | null): Promise<void>;
251
250
  getParticipants(parameters: IGetParticipantsParameters): Promise<ExternalParticipant[]>;
252
251
  getParticipantListChunk(participantListChunkParameters: ParticipantListChunkParameters): Promise<ExternalParticipantListChunk>;
252
+ private _getInitialParticiapntListChunk;
253
253
  private _onLocalMediaStreamChanged;
254
254
  private _onScreenSharingStatus;
255
255
  private _changeRemoteMediaSettings;
@@ -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;
@@ -4,7 +4,8 @@
4
4
  declare enum ConversationOption {
5
5
  REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN",
6
6
  AUDIENCE_MODE = "AUDIENCE_MODE",
7
- WAITING_HALL = "WAITING_HALL"
7
+ WAITING_HALL = "WAITING_HALL",
8
+ ASR = "ASR"
8
9
  }
9
10
  export default ConversationOption;
10
11
  export declare function compareOptions(oldOptions: ConversationOption[], newOptions: ConversationOption[]): boolean;
@@ -23,6 +23,7 @@ declare enum HangupType {
23
23
  EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR",
24
24
  SOCKET_CLOSED = "SOCKET_CLOSED",
25
25
  ENDED = "ENDED",
26
- KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE"
26
+ KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE",
27
+ ANOTHER_DEVICE = "ANOTHER_DEVICE"
27
28
  }
28
29
  export default HangupType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.2-dev.1d98360.0",
3
+ "version": "2.6.2-dev.22f43ca.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>;
@@ -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
  /**
@@ -239,6 +247,11 @@ export declare type ParamsObject = {
239
247
  * Включать RED-extension (redundancy) для p2p звонков
240
248
  */
241
249
  p2pAudioRed: boolean;
250
+ /**
251
+ * Добавлять флаг spsPpsIdrInKeyframe для h264 кодека. В результате ключевые фреймы без sps и pps
252
+ * не используются как ключевые. Решает проблему с артефактами на видео в случае потерь пакетов.
253
+ */
254
+ h264spsPpsIdrInKeyframe: boolean;
242
255
  /**
243
256
  * Получать список участников звонка третьим аргументом в `onConversation`
244
257
  * @hidden
@@ -544,6 +557,7 @@ export default abstract class Params {
544
557
  static get producerCommandDataChannel(): boolean;
545
558
  static get consumerScreenDataChannel(): boolean;
546
559
  static get producerScreenDataChannel(): boolean;
560
+ static get consumerScreenDataChannelPacketSize(): number;
547
561
  static get screenShareWebmBuilder(): boolean;
548
562
  static get noiseSuppression(): boolean;
549
563
  static set noiseSuppression(value: boolean);
@@ -562,6 +576,7 @@ export default abstract class Params {
562
576
  static get participantListChunkInitCount(): number;
563
577
  static get serverAudioRed(): boolean;
564
578
  static get p2pAudioRed(): boolean;
579
+ static get h264spsPpsIdrInKeyframe(): boolean;
565
580
  static get batchParticipantsOnStart(): boolean;
566
581
  static get filterObservers(): boolean;
567
582
  static get muteMode(): boolean;
package/static/Utils.d.ts CHANGED
@@ -6,7 +6,7 @@ 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, isAudioNack?: boolean, preferRed?: boolean): string;
9
+ function patchSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, h264spsPpsIdrInKeyframe: boolean, isAudioNack?: boolean, preferRed?: boolean): string;
10
10
  function getPeerIdString(peerId: SignalingMessage.PeerId): string;
11
11
  function comparePeerId(peerId1: SignalingMessage.PeerId, peerId2: SignalingMessage.PeerId): boolean;
12
12
  function getPeerConnectionHostInfo(pc: RTCPeerConnection): Promise<any>;
@@ -60,5 +60,8 @@ 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>;
65
+ const setImmediate: (fn: VoidFunction) => VoidFunction;
63
66
  }
64
67
  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
  */
@@ -240,6 +240,7 @@ declare namespace SignalingMessage {
240
240
  demote: boolean;
241
241
  mediaModifiers: MediaModifiers;
242
242
  conversation: Conversation;
243
+ participants?: ParticipantListChunk;
243
244
  }
244
245
  export interface ChatRoomUpdated extends Notification {
245
246
  eventType: ChatRoomEventType;
@@ -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
+ };