@vkontakte/calls-sdk 2.6.2-dev.f69c395.0 → 2.6.3-beta.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 (61) hide show
  1. package/CallsSDK.d.ts +85 -20
  2. package/abstract/BaseApi.d.ts +7 -3
  3. package/abstract/BaseSignaling.d.ts +22 -6
  4. package/calls-sdk.cjs.js +9 -9
  5. package/calls-sdk.esm.js +9 -9
  6. package/classes/Conversation.d.ts +80 -14
  7. package/classes/MediaSource.d.ts +7 -2
  8. package/classes/ProducerCommandSerializationService.d.ts +3 -1
  9. package/classes/asr/AsrCommandSerializer.d.ts +3 -0
  10. package/classes/asr/AsrReceiver.d.ts +12 -0
  11. package/classes/codec/IEncoder.d.ts +3 -0
  12. package/classes/codec/LibVPxEncoder.d.ts +4 -1
  13. package/classes/codec/Types.d.ts +6 -1
  14. package/classes/codec/WebCodecsEncoder.d.ts +4 -1
  15. package/classes/screenshare/PacketHistory.d.ts +30 -0
  16. package/classes/screenshare/PacketHistory.test.d.ts +1 -0
  17. package/classes/screenshare/ScreenCaptureSender.d.ts +15 -1
  18. package/classes/screenshare/ScreenCongestionControl.d.ts +25 -0
  19. package/classes/screenshare/SharingStatReport.d.ts +6 -0
  20. package/classes/screenshare/Utils.d.ts +5 -0
  21. package/classes/transport/ServerTransport.d.ts +6 -1
  22. package/classes/transport/Transport.d.ts +3 -1
  23. package/default/Api.d.ts +12 -3
  24. package/default/Api.test.d.ts +1 -0
  25. package/default/Signaling.d.ts +26 -6
  26. package/enums/ConversationFeature.d.ts +2 -1
  27. package/enums/ConversationOption.d.ts +3 -1
  28. package/enums/DataChannelLabel.d.ts +2 -1
  29. package/enums/HangupType.d.ts +3 -1
  30. package/enums/LiveStatus.d.ts +12 -0
  31. package/enums/MediaOption.d.ts +3 -1
  32. package/enums/RoomsEventType.d.ts +6 -0
  33. package/enums/SignalingCommandType.d.ts +12 -1
  34. package/enums/SignalingNotification.d.ts +12 -1
  35. package/package.json +1 -1
  36. package/static/External.d.ts +124 -9
  37. package/static/Params.d.ts +141 -12
  38. package/static/Polyfills.d.ts +7 -0
  39. package/static/Utils.d.ts +2 -1
  40. package/static/WebRTCUtils.d.ts +44 -11
  41. package/static/WebRTCUtils.test.d.ts +1 -0
  42. package/types/Asr.d.ts +11 -0
  43. package/types/Conversation.d.ts +1 -0
  44. package/types/ConversationFeature.d.ts +3 -0
  45. package/types/ConversationParams.d.ts +1 -0
  46. package/types/ExternalId.d.ts +2 -0
  47. package/types/Feedback.d.ts +22 -0
  48. package/types/MediaSettings.d.ts +5 -1
  49. package/types/MovieShare.d.ts +189 -0
  50. package/types/MuteStates.d.ts +15 -0
  51. package/types/Participant.d.ts +3 -0
  52. package/types/ParticipantListChunk.d.ts +2 -0
  53. package/types/ParticipantStreamDescription.d.ts +2 -1
  54. package/types/Room.d.ts +77 -0
  55. package/types/SignalingMessage.d.ts +67 -1
  56. package/types/Streams.d.ts +11 -0
  57. package/types/WaitingHall.d.ts +2 -8
  58. package/utils/ArrayDequeue.d.ts +24 -0
  59. package/utils/ArrayDequeue.spec.d.ts +1 -0
  60. package/utils/Conversation.d.ts +2 -0
  61. package/worker/LibVPxEncoderWorker.d.ts +1 -1
@@ -12,9 +12,12 @@ import UpdateDisplayLayoutErrorReason from '../enums/UpdateDisplayLayoutErrorRea
12
12
  import UserRole from '../enums/UserRole';
13
13
  import UserType from '../enums/UserType';
14
14
  import { JSONObject } from '../static/Json';
15
+ import { AsrInfo } from '../types/Asr';
16
+ import { IFeaturesPerRole } from '../types/ConversationFeature';
15
17
  import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
16
18
  import MediaModifiers from '../types/MediaModifiers';
17
19
  import { IVideoDimentions } from '../types/MediaSettings';
20
+ import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
18
21
  import MuteStates from '../types/MuteStates';
19
22
  import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId } from '../types/Participant';
20
23
  import { ParticipantLayout } from '../types/ParticipantLayout';
@@ -37,6 +40,7 @@ export declare type ConversationData = {
37
40
  */
38
41
  acceptTime: number | null;
39
42
  features: ConversationFeature[];
43
+ featuresPerRole?: IFeaturesPerRole | null;
40
44
  /**
41
45
  * ID звонка
42
46
  */
@@ -46,8 +50,9 @@ export declare type ConversationData = {
46
50
  direction: CallDirection;
47
51
  concurrent: boolean;
48
52
  needRate: boolean;
49
- recordInfo: RecordInfo | null;
53
+ recordsInfoByRoom: Map<number | null, RecordInfo | null>;
50
54
  chatId: string | null;
55
+ asrInfo: AsrInfo | null;
51
56
  /**
52
57
  * Роли пользователя
53
58
  */
@@ -59,11 +64,12 @@ export declare type ConversationData = {
59
64
  pinnedParticipantId: ParticipantId | null;
60
65
  mediaModifiers: MediaModifiers;
61
66
  options: ConversationOption[];
62
- muteStates: MuteStates;
67
+ muteStates: Map<number | null, MuteStates>;
63
68
  unmuteOptions: MediaOption[];
64
69
  networkRating: number;
65
70
  waitingHall: boolean;
66
71
  observer: boolean;
72
+ roomId: number | null;
67
73
  };
68
74
  export declare type ParticipantUpdateInfo = {
69
75
  participantStreamDescription: ParticipantStreamDescription | null;
@@ -76,6 +82,7 @@ export default class Conversation extends EventEmitter {
76
82
  private readonly _signaling;
77
83
  private _mediaSource;
78
84
  private _conversation;
85
+ private _myLastRequestedLayouts;
79
86
  private _state;
80
87
  private _participantState;
81
88
  private _participants;
@@ -106,13 +113,14 @@ export default class Conversation extends EventEmitter {
106
113
  static current(): Conversation | null;
107
114
  static hangupAfterInit(): void;
108
115
  static id(): string | null;
109
- onStart(opponentIds: OkUserId[], opponentType: CallType, mediaOptions: MediaOption[], payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean): Promise<ConversationData>;
116
+ onStart(opponentIds: OkUserId[], opponentType: CallType, mediaOptions: MediaOption[], payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean, onlyAdminCanShareMovie?: boolean): Promise<ConversationData>;
110
117
  onJoin(joinArgs: {
111
118
  conversationId?: string;
112
119
  mediaOptions: MediaOption[];
113
120
  chatId?: string;
114
121
  joinLink?: string;
115
122
  observedIds?: ExternalUserId[];
123
+ payload?: string;
116
124
  }): Promise<ConversationData>;
117
125
  private _onJoinPart2;
118
126
  onPush(conversationId: string, type?: UserType, peerId?: number): Promise<void>;
@@ -151,10 +159,12 @@ export default class Conversation extends EventEmitter {
151
159
  private _processConnection;
152
160
  private _prepareParticipants;
153
161
  private _onConversationParticipantListChunk;
162
+ private _createParticipantListChunk;
154
163
  private _participantListChunkToExternalChunk;
155
164
  private _registerConnectionParticipants;
156
165
  private _registerParticipants;
157
- private _getClientType;
166
+ /** Установим состояние локальных мьютов */
167
+ private _registerParticipantLocalMuteState;
158
168
  private _getStatusByTransportState;
159
169
  private _registerParticipantInCache;
160
170
  private _getExistedParticipantByIdOrCreate;
@@ -167,10 +177,28 @@ export default class Conversation extends EventEmitter {
167
177
  * Обрабатывает данные connection из сигналинга. Должен вызываться после `_registerParticipants`
168
178
  *
169
179
  * @param connection
180
+ */
181
+ private _processConnectionData;
182
+ /**
183
+ * Обрабатывает информацию о сессионных залах
184
+ *
185
+ * @param connection
186
+ */
187
+ private _processRooms;
188
+ /**
189
+ * Обрабатывает информацию о мьютах в основном и сессионных залах
190
+ * @param connection
170
191
  * @private
171
192
  * @hidden
172
193
  */
173
- private _processConnectionData;
194
+ private _processMuteStates;
195
+ /**
196
+ * Обрабатывает информацию о записи/трансляции в основном и сессионных залах
197
+ * @param connection
198
+ * @private
199
+ * @hidden
200
+ */
201
+ private _processRecordInfos;
174
202
  private _allocateTransport;
175
203
  private _createSpeakerDetector;
176
204
  private _createSpecListener;
@@ -188,7 +216,7 @@ export default class Conversation extends EventEmitter {
188
216
  private _onAddParticipant;
189
217
  private _onRemoveParticipant;
190
218
  changeDevice(kind: MediaDeviceKind): Promise<void>;
191
- toggleScreenCapturing(enabled: boolean): Promise<void>;
219
+ toggleScreenCapturing(screenEnabled: boolean, audioShareEnabled: boolean): Promise<void>;
192
220
  setVideoStream(stream: MediaStream, isScreen?: boolean): Promise<void>;
193
221
  setAudioStream(stream: MediaStream): Promise<void>;
194
222
  toggleLocalVideo(enabled: boolean): Promise<void>;
@@ -200,19 +228,32 @@ export default class Conversation extends EventEmitter {
200
228
  requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
201
229
  requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
202
230
  updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
231
+ /** @async */
232
+ feedback(key: string): Promise<SignalingMessage>;
203
233
  private _stopStreaming;
204
234
  private _sendUpdateDisplayLayout;
205
235
  private _cleanupCooldownQueue;
206
236
  private _onParticipantSourcesUpdate;
207
237
  private _onParticipantPromoted;
208
238
  private _onChatRoomUpdated;
239
+ private _onSharedMovieUpdate;
240
+ private _onSharedMovieInfoStarted;
241
+ private _processSharedMovieInfos;
242
+ private _processSharedMovieInfo;
243
+ private _processConnectionSharedMovieInfo;
244
+ private _onSharedMovieInfoStopped;
245
+ private _onFeaturesPerRoleChanged;
209
246
  private _waitForStreamIfNeeded;
210
247
  private _matchStreamDescription;
211
248
  private _getWaitingTime;
212
249
  private _isCallAdmin;
213
250
  private _checkAdminRole;
214
251
  grantRoles(participantId: CompositeUserId, roles: UserRole[], revoke: boolean): Promise<void>;
215
- muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia?: MediaOption[]): Promise<void>;
252
+ startAsr(): Promise<void>;
253
+ stopAsr(): Promise<void>;
254
+ requestAsr(request: boolean): Promise<void>;
255
+ muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia?: MediaOption[], roomId?: number | null): Promise<void>;
256
+ enableFeatureForRoles(feature: ConversationFeature, roles: UserRole[]): Promise<void>;
216
257
  pinParticipant(participantId: ParticipantId, unpin: boolean): Promise<void>;
217
258
  updateMediaModifiers(mediaModifiers: MediaModifiers): Promise<void>;
218
259
  changeOptions(changes: {
@@ -229,15 +270,19 @@ export default class Conversation extends EventEmitter {
229
270
  customData(data: JSONObject, participantId?: ParticipantId | null): Promise<void>;
230
271
  createJoinLink(): Promise<string>;
231
272
  removeJoinLink(): Promise<never>;
232
- addMovie(movieId: string): Promise<{
233
- movieId: string;
273
+ addMovie({ movieId, gain, metadata }: IAddMovieParams): Promise<{
274
+ movieId: number;
234
275
  streamType: string;
235
276
  }>;
236
- updateMovie(movieId: string, gain?: number, offset?: string, pause?: boolean): Promise<void>;
237
- removeMovie(movieId: string): Promise<void>;
238
- startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null): Promise<SignalingMessage>;
239
- stopStream(): Promise<SignalingMessage>;
240
- recordSetRole(participantId: ParticipantId, role: RecordRole | null): Promise<void>;
277
+ updateMovie(params: IUpdateMovieData): Promise<void>;
278
+ removeMovie(movieId: number): Promise<void>;
279
+ updateRooms(rooms: SignalingMessage.Room[], assignRandomly: boolean): Promise<void>;
280
+ activateRooms(roomIds: number[], deactivate: boolean): Promise<void>;
281
+ switchRoom(toRoomId: number | null, participantId?: ParticipantId): Promise<void>;
282
+ removeRooms(roomIds: number[]): Promise<void>;
283
+ startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null, roomId?: number | null): Promise<SignalingMessage>;
284
+ stopStream(roomId?: number | null): Promise<SignalingMessage>;
285
+ recordSetRole(participantId: ParticipantId, role: RecordRole | null, roomId?: number | null): Promise<void>;
241
286
  getStreamInfo(): Promise<{
242
287
  movieId: any;
243
288
  preview: any;
@@ -275,11 +320,15 @@ export default class Conversation extends EventEmitter {
275
320
  private _onChatMessage;
276
321
  private _onCustomData;
277
322
  private _onRecordInfo;
323
+ _changeRecordInfoForRoom(): Promise<void>;
324
+ private _onAsrInfo;
325
+ private _onAsrTranscription;
278
326
  private _onRolesChanged;
279
327
  /**
280
328
  * Клиент должен немедленно выключить микрофон и/или камеру
281
329
  */
282
330
  private _onMuteParticipant;
331
+ private _changeMuteStatesForRoom;
283
332
  private _processMuteState;
284
333
  private _onPinParticipant;
285
334
  private _onOptionsChanged;
@@ -305,6 +354,23 @@ export default class Conversation extends EventEmitter {
305
354
  private _updateDisplayLayoutFromCache;
306
355
  private _setParticipantsStatus;
307
356
  private _onJoinLinkChanged;
357
+ private _onRoomsUpdated;
358
+ private _onRoomUpdated;
359
+ private _convertRoomToExternal;
360
+ private _onRoomParticipantsUpdated;
361
+ /**
362
+ * @param roomId
363
+ * @param isStartEvent в случае true будет отправлено стартовое событие установки id сессионного зала
364
+ * @private
365
+ */
366
+ private _onRoomSwitched;
367
+ private _refreshRooms;
368
+ /** получили из сингналинга сообщение о реакции пользователей */
369
+ private _onFeedback;
370
+ private _isMe;
371
+ private _getMuteStatesForRoomId;
372
+ private _getMuteStatesForCurrentRoom;
373
+ private _setMuteStatesForRoomId;
308
374
  }
309
375
  export declare class UpdateDisplayLayoutError extends Error {
310
376
  readonly participantErrors: {
@@ -13,7 +13,8 @@ export declare const enum MediaSourceEvent {
13
13
  export declare const enum MediaTrackKind {
14
14
  'audio' = "audio",
15
15
  'video' = "video",
16
- 'screen' = "screen"
16
+ 'screen' = "screen",
17
+ 'audioshare' = "audioshare"
17
18
  }
18
19
  export declare class MediaSource extends EventEmitter {
19
20
  /** Стрим с камеры и микрофона пользователя */
@@ -21,6 +22,7 @@ export declare class MediaSource extends EventEmitter {
21
22
  /** Последний сохраненный оригинальный видео трек с камеры */
22
23
  private _trackVideoStreamBackup;
23
24
  private _screenTrack;
25
+ private _audioShareTrack;
24
26
  /** Трек для отправки в медиа-канал. Может отличаться при скриншаринге в дата-канал */
25
27
  private _sendVideoTrack;
26
28
  private _mediaSettings;
@@ -58,16 +60,19 @@ export declare class MediaSource extends EventEmitter {
58
60
  private _changeAudioInput;
59
61
  private _changeScreen;
60
62
  private _disableScreenCapture;
63
+ private disableAudioShare;
64
+ private getSilentAudioShareTrack;
61
65
  private _replaceLocalTrack;
62
66
  private _stopLocalTrack;
63
67
  private _videoEffect;
64
68
  /** останавливает и удаляет сохраненный трек с камеры пользователя */
65
69
  private _stopAndRemoveTrackVideoStreamBackup;
66
70
  destroy(): void;
67
- toggleScreenCapturing(enabled: boolean): Promise<void>;
71
+ toggleScreenCapturing(captureScreen: boolean, captureAudio: boolean): Promise<void>;
68
72
  toggleVideo(enabled: boolean): Promise<void>;
69
73
  toggleAudio(enabled: boolean): Promise<void>;
70
74
  setResolution(width: number, height: number): Promise<void>;
71
75
  updateNoiseSuppression(): Promise<void>;
72
76
  videoEffect(effect: IEffect | null): Promise<void>;
77
+ getAudioShareTrack(): MediaStreamTrack | null;
73
78
  }
@@ -1,5 +1,6 @@
1
1
  import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
2
2
  import SignalingMessage from '../types/SignalingMessage';
3
+ import { SharingStatReport } from './screenshare/SharingStatReport';
3
4
  import { ParticipantIdRegistry } from './ParticipantIdRegistry';
4
5
  import { PerfStatReport } from './transport/PerfStatReporter';
5
6
  export declare class ProducerCommandSerializationService {
@@ -11,7 +12,8 @@ export declare class ProducerCommandSerializationService {
11
12
  private writeLayout;
12
13
  private writeStreamDesc;
13
14
  serializePerfStatReport(sequenceNumber: number, report: PerfStatReport): ArrayBuffer;
14
- deserializeCommandResponse(data: BufferSource): SignalingMessage | undefined;
15
+ serializeSharingStatReport(sequenceNumber: number, report: SharingStatReport): ArrayBuffer;
16
+ deserializeCommandResponse(data: BufferSource | Blob): Promise<SignalingMessage | undefined>;
15
17
  private deserializeUpdateDisplayLayoutResponse;
16
18
  private deserializeReportPerfStatResponse;
17
19
  }
@@ -0,0 +1,3 @@
1
+ export declare class AsrCommandSerializer {
2
+ requestAsr(request: boolean): ArrayBuffer;
3
+ }
@@ -0,0 +1,12 @@
1
+ import { AsrTranscription } from '../../types/Asr';
2
+ import { ParticipantIdRegistry } from '../ParticipantIdRegistry';
3
+ export declare class AsrReceiver {
4
+ private readonly _datachannel;
5
+ private readonly _participantIdRegistry;
6
+ private readonly _asrCallback;
7
+ private readonly _textDecoder;
8
+ constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, callback: (asr: AsrTranscription) => void);
9
+ private static parse;
10
+ private _onDataChannelMessage;
11
+ destroy(): void;
12
+ }
@@ -4,6 +4,7 @@ export default interface IEncoder {
4
4
  requestFrame(keyFrame: boolean): void;
5
5
  isVP9(): boolean;
6
6
  destroy(): void;
7
+ setBitrate(bitrate: number, useCbr: boolean): void;
7
8
  }
8
9
  export interface FrameMessage {
9
10
  type: MessageType;
@@ -12,4 +13,6 @@ export interface FrameMessage {
12
13
  duration?: number;
13
14
  data?: ArrayBuffer;
14
15
  error?: string;
16
+ width?: number;
17
+ height?: number;
15
18
  }
@@ -4,6 +4,8 @@ import WorkerBase from './WorkerBase';
4
4
  export default class LibVPxEncoder extends WorkerBase implements IEncoder {
5
5
  private readonly _sourceTrack;
6
6
  private readonly _onFrame;
7
+ private readonly _useCongestionControl;
8
+ private readonly _maxBitrate;
7
9
  private readonly _useImageCapture;
8
10
  private _video;
9
11
  private _imageCapture;
@@ -13,7 +15,7 @@ export default class LibVPxEncoder extends WorkerBase implements IEncoder {
13
15
  private _track;
14
16
  private _frameReadTimeout;
15
17
  private _lastFrame;
16
- constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback);
18
+ constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number);
17
19
  private _createDom;
18
20
  private _removeDom;
19
21
  private _createStream;
@@ -27,6 +29,7 @@ export default class LibVPxEncoder extends WorkerBase implements IEncoder {
27
29
  private _requestFrameVideo;
28
30
  private _requestFrameBitmap;
29
31
  requestFrame(keyFrame?: boolean): void;
32
+ setBitrate(bitrate: number, useCbr?: boolean): void;
30
33
  isVP9(): boolean;
31
34
  destroy(): void;
32
35
  static isBrowserSupported(): boolean;
@@ -6,9 +6,14 @@ export declare const enum MessageType {
6
6
  INIT = "init",
7
7
  READY = "ready",
8
8
  FRAME = "frame",
9
+ SET_BITRATE = "set_bitrate",
9
10
  ERROR = "error",
10
11
  DEBUG = "debug",
11
12
  LOG_ERROR = "log_error"
12
13
  }
13
- export declare type EncodedVideoFrame = Pick<EncodedVideoChunk, 'type' | 'timestamp' | 'duration' | 'byteLength' | 'data'>;
14
+ export declare type EncodedVideoFrame = Pick<EncodedVideoChunk, 'type' | 'timestamp' | 'duration' | 'byteLength' | 'data'> & {
15
+ width: number;
16
+ height: number;
17
+ };
14
18
  export declare type OnFrameCallback = (chunk: EncodedVideoFrame | null, error?: string) => void;
19
+ export declare type OnCongestionCallback = (bitrate: number, useCbr: boolean) => void;
@@ -5,9 +5,12 @@ export default class WebCodecsEncoder extends WorkerBase implements IEncoder {
5
5
  private readonly _sourceTrack;
6
6
  private readonly _trackProcessor;
7
7
  private readonly _onFrame;
8
- constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback);
8
+ private readonly _useCongestionControl;
9
+ private readonly _maxBitrate;
10
+ constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number);
9
11
  init(): Promise<void>;
10
12
  requestFrame(keyFrame?: boolean): void;
13
+ setBitrate(bitrate: number, useCbr: boolean): void;
11
14
  isVP9(): boolean;
12
15
  destroy(): void;
13
16
  static isBrowserSupported(): boolean;
@@ -0,0 +1,30 @@
1
+ declare type HistoryRecord = {
2
+ seq: number;
3
+ ts: number;
4
+ size: number;
5
+ sent: number;
6
+ start: boolean;
7
+ end: boolean;
8
+ ts2: number;
9
+ recv: number;
10
+ };
11
+ /**
12
+ * Class calculates server bitrate and delay, based on server cc feedback
13
+ * Ring buffer to keep sent packets info (HistoryRecord)
14
+ * Packet info is updated when cc feedback is received from server
15
+ */
16
+ export default class PacketHistory {
17
+ private readonly _maxSize;
18
+ private _size;
19
+ private readonly _buffer;
20
+ private _head;
21
+ private _tail;
22
+ constructor(maxSize: number);
23
+ add(seq: number, ts: number, size: number, start: boolean, end: boolean): number;
24
+ update(seq: number, ts2: number): HistoryRecord;
25
+ get(seq: number): HistoryRecord;
26
+ getServerBitrateK(windowMs: number): number;
27
+ getCurrentDelay(): number;
28
+ getMaxBandwidth(): number;
29
+ }
30
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,19 @@
1
+ import BaseSignaling from '../../abstract/BaseSignaling';
1
2
  export default class ScreenCaptureSender {
2
3
  private readonly _encoder;
3
4
  private readonly _datachannel;
5
+ private readonly _signaling;
4
6
  private _destroyed;
5
7
  private _needKeyframe;
6
8
  private readonly DATA_SIZE;
7
- constructor(track: MediaStreamTrack, datachannel: RTCDataChannel);
9
+ private _congestionControl;
10
+ private _frameNum;
11
+ private _width;
12
+ private _height;
13
+ private _feedback;
14
+ private _lastSharingStat;
15
+ private _congestionControlEnabled;
16
+ constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: BaseSignaling);
8
17
  private _requestFrame;
9
18
  private _wrapHeader;
10
19
  private _stopPacket;
@@ -12,4 +21,9 @@ export default class ScreenCaptureSender {
12
21
  private _sendChunk;
13
22
  destroy(): void;
14
23
  static isBrowserSupported(): boolean;
24
+ private _onCongestionCallback;
25
+ private _onResize;
26
+ private _calcMinMaxBitrate;
27
+ private _checkCcFeedback;
28
+ private _sendSharingStat;
15
29
  }
@@ -0,0 +1,25 @@
1
+ import { OnCongestionCallback } from '../codec/Types';
2
+ import { SharingStatReport } from './SharingStatReport';
3
+ export default class ScreenCongestionControl {
4
+ private readonly _onCongestion;
5
+ private readonly _ccEnabled;
6
+ private _minBitrate;
7
+ private _maxBitrate;
8
+ private _targetBitrate;
9
+ private _lastDown;
10
+ private _lastUp;
11
+ private _lastProbing;
12
+ private _lastCheckDelay;
13
+ private _upPenalty;
14
+ private _probing;
15
+ private _delayAvgShort;
16
+ private _delayAvgLong;
17
+ private _minDelay;
18
+ private _maxDelay;
19
+ private _largeDelayDuration;
20
+ constructor(onCongestion: OnCongestionCallback, minBitrate: number, maxBitrate: number, ccEnabled: boolean);
21
+ checkDelay(frameNum: number, delay: number, bitrateK: number): void;
22
+ private _calcDelay;
23
+ reconfigure(minBitrate: number, maxBitrate: number): void;
24
+ getStat(): SharingStatReport;
25
+ }
@@ -0,0 +1,6 @@
1
+ export declare type SharingStatReport = {
2
+ minDelay: number;
3
+ maxDelay: number;
4
+ avgDelay: number;
5
+ largeDelayDuration: number;
6
+ };
@@ -15,3 +15,8 @@ export interface FrameChunk extends FrameChunkHeader {
15
15
  export declare function wrapHeader(timestamp: number, start: boolean, end: boolean, keyframe: boolean, sequence: number, isVP9: boolean, data: ArrayBuffer | null): ArrayBuffer;
16
16
  export declare function parseChunk(data: ArrayBuffer): FrameChunk;
17
17
  export declare function isKeyframeRequested(data?: ArrayBuffer): boolean;
18
+ export interface CcFeedback {
19
+ seq: number;
20
+ ts2: number;
21
+ }
22
+ export declare function parseCcFeedback(data?: ArrayBuffer): CcFeedback;
@@ -13,6 +13,7 @@ export default class ServerTransport extends EventEmitter {
13
13
  private _producerCommand;
14
14
  private _producerScreen;
15
15
  private _consumerScreen;
16
+ private _asr;
16
17
  private _isOpen;
17
18
  private _observer;
18
19
  private _reconnectionPrevented;
@@ -27,12 +28,14 @@ export default class ServerTransport extends EventEmitter {
27
28
  private _lastStat;
28
29
  private _serverSettings;
29
30
  private _prevConsumerSettings;
31
+ private _asrTrack;
30
32
  private _captureSender;
31
33
  private _captureReceiver;
32
34
  private _participantIdRegistry;
33
35
  private _disabledSenders;
34
36
  private _rtpReceiversByStreamId;
35
37
  private _producerSessionId;
38
+ private _newAudioShareTrack;
36
39
  constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings);
37
40
  getState(): TransportState;
38
41
  updateStatisticsInterval(): void;
@@ -46,6 +49,7 @@ export default class ServerTransport extends EventEmitter {
46
49
  private static _closeDataChannel;
47
50
  private _createDataChannel;
48
51
  private _openConnection;
52
+ private _removeAsrTrack;
49
53
  private _reconnect;
50
54
  private _signalActiveParticipants;
51
55
  private _signalStalledParticipants;
@@ -68,12 +72,13 @@ export default class ServerTransport extends EventEmitter {
68
72
  private _detectStaleTracks;
69
73
  private _allocateConsumer;
70
74
  private _acceptProducer;
75
+ private handleTracks;
71
76
  _onSignalingNotification(message: SignalingMessage): Promise<void>;
77
+ private _onAsrTranscription;
72
78
  private _onProducerUpdated;
73
79
  private _onAddTrack;
74
80
  static _onSignalingStateChange(pc: RTCPeerConnection, event: any): void;
75
81
  private _onConnectionStateChange;
76
82
  private _onReplacedTrack;
77
- private static _isUnifiedPlanSupported;
78
83
  getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
79
84
  }
@@ -16,7 +16,8 @@ export declare const enum TransportEvent {
16
16
  SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS",
17
17
  TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED",
18
18
  NETWORK_STATUS = "NETWORK_STATUS",
19
- PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED"
19
+ PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED",
20
+ ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION"
20
21
  }
21
22
  export declare const enum TransportState {
22
23
  IDLE = "IDLE",
@@ -81,5 +82,6 @@ export declare class Transport extends EventEmitter {
81
82
  private _onDirectRemoteDataStats;
82
83
  private _onServerRemoteTrackAdded;
83
84
  private _onServerRemoteTrackRemoved;
85
+ private _onAsrTranscription;
84
86
  getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
85
87
  }
package/default/Api.d.ts CHANGED
@@ -8,16 +8,25 @@ export default class Api extends BaseApi {
8
8
  private _userId;
9
9
  private _uuid;
10
10
  private _externalUidsCache;
11
+ private _extrnalUidsBatchPromise?;
12
+ private _extrnalUidsBatch;
13
+ private _extrnalUidsBatchTimeout;
11
14
  private _callUnsafe;
12
15
  private _call;
13
16
  userId(compositeUserId: CompositeUserId): Promise<ExternalId>;
14
17
  prepareUserIds(ids: OkUserId[]): Promise<void>;
18
+ private _prepareUserIdsByOkIdsBatched;
15
19
  authorize(): Promise<void>;
16
20
  log(items: LogItem[]): void;
17
21
  init(): void;
18
22
  joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
19
- createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean): Promise<ConversationResponse>;
20
- startConversation(conversationId: string, ids?: OkUserId[], type?: CallType, isVideo?: boolean, payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean): Promise<ConversationResponse>;
23
+ createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie }?: {
24
+ onlyAdminCanShareMovie?: boolean;
25
+ }): Promise<ConversationResponse>;
26
+ startConversation(conversationId: string, ids?: OkUserId[], type?: CallType, isVideo?: boolean, payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie }?: {
27
+ onlyAdminCanShareMovie?: boolean;
28
+ }): Promise<ConversationResponse>;
29
+ private _preareStartConversationData;
21
30
  private _startConversation;
22
31
  createJoinLink(conversationId: string): Promise<{
23
32
  join_link: string;
@@ -26,7 +35,7 @@ export default class Api extends BaseApi {
26
35
  success: boolean;
27
36
  }>;
28
37
  getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
29
- joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[]): Promise<ConversationResponse>;
38
+ joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
30
39
  /**
31
40
  * NB: Не сохраняет порядок возвращаемых ID
32
41
  * @hidden
@@ -0,0 +1 @@
1
+ export {};