@vkontakte/calls-sdk 2.6.2-beta.1 → 2.6.2-beta.11

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,9 +151,12 @@ 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;
158
+ /** Установим состояние локальных мьютов */
159
+ private _registerParticipantLocalMuteState;
157
160
  private _getClientType;
158
161
  private _getStatusByTransportState;
159
162
  private _registerParticipantInCache;
@@ -203,8 +206,6 @@ export default class Conversation extends EventEmitter {
203
206
  private _stopStreaming;
204
207
  private _sendUpdateDisplayLayout;
205
208
  private _cleanupCooldownQueue;
206
- private static _isStopStreaming;
207
- private static _layoutToString;
208
209
  private _onParticipantSourcesUpdate;
209
210
  private _onParticipantPromoted;
210
211
  private _onChatRoomUpdated;
@@ -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 | Blob): Promise<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;
package/default/Api.d.ts CHANGED
@@ -18,6 +18,7 @@ export default class Api extends BaseApi {
18
18
  joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
19
19
  createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean): Promise<ConversationResponse>;
20
20
  startConversation(conversationId: string, ids?: OkUserId[], type?: CallType, isVideo?: boolean, payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean): Promise<ConversationResponse>;
21
+ private _preareStartConversationData;
21
22
  private _startConversation;
22
23
  createJoinLink(conversationId: string): Promise<{
23
24
  join_link: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -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;
@@ -16,6 +16,7 @@ declare enum HangupType {
16
16
  CALLER_IS_BLOCKED = "CALLER_IS_BLOCKED",
17
17
  NOT_FRIENDS = "NOT_FRIENDS",
18
18
  CALLEE_IS_OFFLINE = "CALLEE_IS_OFFLINE",
19
+ CALLER_IS_REJECTED = "CALLER_IS_REJECTED",
19
20
  UNKNOWN_ERROR = "UNKNOWN_ERROR",
20
21
  UNSUPPORTED = "UNSUPPORTED",
21
22
  OLD_VERSION = "OLD_VERSION",
@@ -23,6 +24,7 @@ declare enum HangupType {
23
24
  EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR",
24
25
  SOCKET_CLOSED = "SOCKET_CLOSED",
25
26
  ENDED = "ENDED",
26
- KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE"
27
+ KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE",
28
+ ANOTHER_DEVICE = "ANOTHER_DEVICE"
27
29
  }
28
30
  export default HangupType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.2-beta.1",
3
+ "version": "2.6.2-beta.11",
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
  *
@@ -43,6 +43,11 @@ export declare type ParamsObject = {
43
43
  * Домен, чтобы попасть в тестовую группу. Для тестирования экспериментальных улучшений существуют отдельные сервера, чтобы собирать фидбек и уже потом раскатывать на всех юзеров. Если передать сюда специальный ключ, то конверсейшн будет обрабатываться на таком сервере.
44
44
  */
45
45
  domain: string;
46
+ /**
47
+ * Домен, куда будет ходить Ok api за данными
48
+ * @hidden
49
+ */
50
+ externalDomain: string;
46
51
  iceServers: IceServer[];
47
52
  wssBase: string;
48
53
  wssToken: string;
@@ -186,6 +191,7 @@ export declare type ParamsObject = {
186
191
  * Работает только при приёме экрана через дата-канал.
187
192
  *
188
193
  * _По умолчанию: `true`_
194
+ * @deprecated
189
195
  */
190
196
  producerScreenTrack: boolean;
191
197
  /**
@@ -193,12 +199,19 @@ export declare type ParamsObject = {
193
199
  * Работает только при отправке экрана через дата-канал.
194
200
  *
195
201
  * _По умолчанию: `true`_
202
+ * @deprecated
196
203
  */
197
204
  consumerScreenTrack: boolean;
198
205
  producerNotificationDataChannel: boolean;
199
206
  producerCommandDataChannel: boolean;
200
207
  consumerScreenDataChannel: boolean;
201
208
  producerScreenDataChannel: boolean;
209
+ /**
210
+ * Размер пакета для отправки трансляции экрана в датаканал в байтах.
211
+ * Максимальный размер пакета 65536 bytes в хроме, но по стандарту лучше максимум 16 Кб.
212
+ * @hidden
213
+ */
214
+ consumerScreenDataChannelPacketSize: number;
202
215
  screenShareWebmBuilder: boolean;
203
216
  noiseSuppression: boolean;
204
217
  /**
@@ -239,6 +252,11 @@ export declare type ParamsObject = {
239
252
  * Включать RED-extension (redundancy) для p2p звонков
240
253
  */
241
254
  p2pAudioRed: boolean;
255
+ /**
256
+ * Добавлять флаг spsPpsIdrInKeyframe для h264 кодека. В результате ключевые фреймы без sps и pps
257
+ * не используются как ключевые. Решает проблему с артефактами на видео в случае потерь пакетов.
258
+ */
259
+ h264spsPpsIdrInKeyframe: boolean;
242
260
  /**
243
261
  * Получать список участников звонка третьим аргументом в `onConversation`
244
262
  * @hidden
@@ -349,7 +367,7 @@ export declare type ParamsObject = {
349
367
  /**
350
368
  * Изменились состояния устройств пользователя или разрешения включать камеру/микрофон
351
369
  */
352
- onMuteStates?: (muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll: boolean, unmute: boolean, userId: ExternalParticipantId | null, adminId: ExternalParticipantId | null) => void;
370
+ onMuteStates?: (muteStates: MuteStates, unmuteOptions: MediaOption[], mediaOptions: MediaOption[], muteAll: boolean, unmute: boolean, userId: ExternalParticipantId | null, adminId: ExternalParticipantId | null, stateUpdated?: boolean, requestedMedia?: MediaOption[]) => void;
353
371
  /**
354
372
  * Изменились роли собеседника в звонке
355
373
  */
@@ -495,6 +513,7 @@ export default abstract class Params {
495
513
  static get anonymToken(): string;
496
514
  static set anonymToken(value: string);
497
515
  static get domain(): string;
516
+ static get externalDomain(): string;
498
517
  static get iceServers(): IceServer[];
499
518
  static set iceServers(value: IceServer[]);
500
519
  static get wssBase(): string;
@@ -544,6 +563,7 @@ export default abstract class Params {
544
563
  static get producerCommandDataChannel(): boolean;
545
564
  static get consumerScreenDataChannel(): boolean;
546
565
  static get producerScreenDataChannel(): boolean;
566
+ static get consumerScreenDataChannelPacketSize(): number;
547
567
  static get screenShareWebmBuilder(): boolean;
548
568
  static get noiseSuppression(): boolean;
549
569
  static set noiseSuppression(value: boolean);
@@ -562,6 +582,7 @@ export default abstract class Params {
562
582
  static get participantListChunkInitCount(): number;
563
583
  static get serverAudioRed(): boolean;
564
584
  static get p2pAudioRed(): boolean;
585
+ static get h264spsPpsIdrInKeyframe(): boolean;
565
586
  static get batchParticipantsOnStart(): boolean;
566
587
  static get filterObservers(): boolean;
567
588
  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,9 @@ 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
+ function objectReduce<R, T extends Object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
66
+ const setImmediate: (fn: VoidFunction) => VoidFunction;
63
67
  }
64
68
  export default Utils;
@@ -0,0 +1,12 @@
1
+ import MediaOption from '../enums/MediaOption';
2
+ import MediaSettings from './MediaSettings';
3
+ import { Participant } from './Participant';
4
+ export interface IProcessMuteStateParams {
5
+ mediaOptions?: MediaOption[];
6
+ muteAll?: boolean;
7
+ unmute?: boolean;
8
+ serverSettings?: MediaSettings | null;
9
+ admin?: Participant | null;
10
+ stateUpdated?: boolean;
11
+ requestedMedia?: MediaOption[];
12
+ }
@@ -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
  }
@@ -0,0 +1,2 @@
1
+ import { MuteState, MediaOption, MuteStates } from '../CallsSDK';
2
+ export declare const getMediaOptionsByMuteState: (muteStates: MuteStates, value: MuteState) => MediaOption[];
@@ -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
+ };