@vkontakte/calls-sdk 2.6.3-dev.df409e1.0 → 2.6.3-dev.e77d93a.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.
@@ -24,6 +24,7 @@ import { ParticipantLayout } from '../types/ParticipantLayout';
24
24
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
25
25
  import ParticipantPriority from '../types/ParticipantPriority';
26
26
  import { ParticipantStreamDescription } from '../types/ParticipantStreamDescription';
27
+ import { ScreenCaptureSettings } from '../types/ScreenCaptureSettings';
27
28
  import SignalingMessage, { RecordInfo } from '../types/SignalingMessage';
28
29
  import { WaitingHallResponse } from '../types/WaitingHall';
29
30
  import EventEmitter from './EventEmitter';
@@ -216,7 +217,16 @@ export default class Conversation extends EventEmitter {
216
217
  private _onAddParticipant;
217
218
  private _onRemoveParticipant;
218
219
  changeDevice(kind: MediaDeviceKind): Promise<void>;
219
- toggleScreenCapturing(screenEnabled: boolean, audioShareEnabled: boolean): Promise<void>;
220
+ toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
221
+ disableScreenCapturing(): Promise<void>;
222
+ toggleAnimojiCapturing(state: boolean): void;
223
+ setAnimojiSvg(
224
+ /** svg в незашифрованном (string) или зашифрованном (ArrayBuffer) виде */
225
+ svg: string | ArrayBuffer,
226
+ /** participantId внешнего участника звонка, не требуется для текущего участника (текущего пользователя клиента) */
227
+ participantId?: ParticipantId | null,
228
+ /** ключ расшифровки svg внешнего пользователя или кастомный ключ, не требуется для незашифрованных svg */
229
+ decryptionKey?: string | null): void;
220
230
  setVideoStream(stream: MediaStream, isScreen?: boolean): Promise<void>;
221
231
  setAudioStream(stream: MediaStream): Promise<void>;
222
232
  toggleLocalVideo(enabled: boolean): Promise<void>;
@@ -334,6 +344,12 @@ export default class Conversation extends EventEmitter {
334
344
  private _onOptionsChanged;
335
345
  private _onNetworkStatus;
336
346
  private _onRemoteStreamSecond;
347
+ /**
348
+ * Коллбек, вызывающийся при получении/остановке стрима от AnimojiReceiver
349
+ * @param participantId - участник, к которому относится стрим
350
+ * @param stream - стрим анимированного аватара, null в случае остановки стрима
351
+ */
352
+ private _onAnimojiStream;
337
353
  private _onPeerConnectionClosed;
338
354
  private _changeFeatureSet;
339
355
  private _changeNeedRate;
@@ -2,10 +2,12 @@ import type { IEffect } from '@vkontakte/calls-video-effects';
2
2
  import EventEmitter from '../classes/EventEmitter';
3
3
  import MediaOption from '../enums/MediaOption';
4
4
  import MediaSettings from '../types/MediaSettings';
5
+ import { ScreenCaptureSettings } from '../types/ScreenCaptureSettings';
5
6
  export declare const enum MediaSourceEvent {
6
7
  SOURCE_CHANGED = "SOURCE_CHANGED",
7
8
  TRACK_REPLACED = "TRACK_REPLACED",
8
- SCREEN_STATUS = "SCREEN_STATUS"
9
+ SCREEN_STATUS = "SCREEN_STATUS",
10
+ ANIMOJI_STATUS = "ANIMOJI_STATUS"
9
11
  }
10
12
  /**
11
13
  * Тип трека
@@ -31,12 +33,15 @@ export declare class MediaSource extends EventEmitter {
31
33
  private _onDeviceChange;
32
34
  /** MediaSource занят при переключении камеры или микрофона */
33
35
  private _sourceBusy;
36
+ /** Состояние выключателя Animoji в UI */
37
+ private _animojiEnabled;
34
38
  constructor();
35
39
  request(mediaOptions?: MediaOption[], needEmptyTracks?: boolean): Promise<void>;
36
40
  getStream(): MediaStream | null;
37
41
  getScreenTrack(): MediaStreamTrack | null;
38
42
  getSendVideoTrack(noDataChannel?: boolean): MediaStreamTrack | null;
39
43
  private _getSendAudioTrack;
44
+ getAnimojiEnabled(): boolean;
40
45
  addTrackToPeerConnection(pc: RTCPeerConnection, observer: boolean, noDataChannel: boolean, audioRed: boolean): void;
41
46
  getMediaSettings(): MediaSettings;
42
47
  changeDevice(kind: MediaDeviceKind): Promise<void>;
@@ -73,9 +78,13 @@ export declare class MediaSource extends EventEmitter {
73
78
  /** останавливает и удаляет сохраненный трек с камеры пользователя */
74
79
  private _stopAndRemoveTrackVideoStreamBackup;
75
80
  destroy(): void;
76
- toggleScreenCapturing(captureScreen: boolean, captureAudio: boolean): Promise<void>;
81
+ toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
82
+ disableScreenCapturing(): Promise<void>;
77
83
  toggleVideo(enabled: boolean): Promise<void>;
78
84
  toggleAudio(enabled: boolean): Promise<void>;
85
+ toggleAnimojiCapturing(enabled: boolean): void;
86
+ onAnimojiSender(created: boolean): void;
87
+ onAnimojiStream(stream?: MediaStream | null): Promise<void>;
79
88
  setResolution(width: number, height: number): Promise<void>;
80
89
  updateNoiseSuppression(): Promise<void>;
81
90
  videoEffect(effect: IEffect | null): Promise<void>;
@@ -7,7 +7,9 @@ export default class WebCodecsEncoder extends WorkerBase implements IEncoder {
7
7
  private readonly _onFrame;
8
8
  private readonly _useCongestionControl;
9
9
  private readonly _maxBitrate;
10
- constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number);
10
+ private readonly _useCbr;
11
+ private readonly _frameRate;
12
+ constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, useCbr: boolean, frameRate: number);
11
13
  init(): Promise<void>;
12
14
  requestFrame(keyFrame?: boolean): void;
13
15
  setBitrate(bitrate: number, useCbr: boolean): void;
@@ -3,6 +3,7 @@ export default class ScreenCaptureSender {
3
3
  private readonly _encoder;
4
4
  private readonly _datachannel;
5
5
  private readonly _signaling;
6
+ private readonly _fastSharing;
6
7
  private _destroyed;
7
8
  private _needKeyframe;
8
9
  private readonly DATA_SIZE;
@@ -13,7 +14,7 @@ export default class ScreenCaptureSender {
13
14
  private _feedback;
14
15
  private _lastSharingStat;
15
16
  private _congestionControlEnabled;
16
- constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: BaseSignaling);
17
+ constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: BaseSignaling, fastSharing: boolean);
17
18
  private _requestFrame;
18
19
  private _wrapHeader;
19
20
  private _stopPacket;
@@ -3,6 +3,7 @@ import { SharingStatReport } from './SharingStatReport';
3
3
  export default class ScreenCongestionControl {
4
4
  private readonly _onCongestion;
5
5
  private readonly _ccEnabled;
6
+ private readonly _fastSharing;
6
7
  private _minBitrate;
7
8
  private _maxBitrate;
8
9
  private _targetBitrate;
@@ -17,8 +18,9 @@ export default class ScreenCongestionControl {
17
18
  private _minDelay;
18
19
  private _maxDelay;
19
20
  private _largeDelayDuration;
20
- constructor(onCongestion: OnCongestionCallback, minBitrate: number, maxBitrate: number, ccEnabled: boolean);
21
+ constructor(onCongestion: OnCongestionCallback, minBitrate: number, maxBitrate: number, ccEnabled: boolean, fastSharing: boolean);
21
22
  checkDelay(frameNum: number, delay: number, bitrateK: number): void;
23
+ private _setBitrate;
22
24
  private _calcDelay;
23
25
  reconfigure(minBitrate: number, maxBitrate: number): void;
24
26
  getStat(): SharingStatReport;
@@ -1,3 +1,4 @@
1
+ import type { AnimojiSvgData } from '@vkontakte/calls-vmoji';
1
2
  import BaseSignaling from '../../abstract/BaseSignaling';
2
3
  import { ParticipantId } from '../../types/Participant';
3
4
  import ServerSettings from '../../types/ServerSettings';
@@ -13,6 +14,10 @@ export default class DirectTransport extends EventEmitter {
13
14
  private _remoteSDP;
14
15
  private _remoteCandidates;
15
16
  private _state;
17
+ private _animojiDataChannel;
18
+ private _animojiReceiver;
19
+ private _animojiSender;
20
+ private _animojiSvgDataByParticipantId;
16
21
  private _isOpen;
17
22
  private _remotePeerId;
18
23
  private _statInterval;
@@ -39,6 +44,7 @@ export default class DirectTransport extends EventEmitter {
39
44
  preventRestart(): void;
40
45
  allowRestart(): void;
41
46
  close(error?: Error): void;
47
+ setAnimojiSvg(participantId: ParticipantId, svgData: AnimojiSvgData): void;
42
48
  private _setState;
43
49
  private _onSignalingNotification;
44
50
  private _handleTransmittedData;
@@ -58,6 +64,7 @@ export default class DirectTransport extends EventEmitter {
58
64
  private _createAnswer;
59
65
  private static _patchDescription;
60
66
  private _onReplacedTrack;
67
+ private _onAnimojiStatus;
61
68
  private _startStatInterval;
62
69
  private _stopStatInterval;
63
70
  private _checkBadNetwork;
@@ -65,4 +72,9 @@ export default class DirectTransport extends EventEmitter {
65
72
  private _stopSettingsInterval;
66
73
  private _calcFingerprint;
67
74
  private _applySettings;
75
+ private _createDataChannel;
76
+ private _createAnimojiReceiver;
77
+ private _removeAnimojiReceiver;
78
+ private _createAnimojiSender;
79
+ private _removeAnimojiSender;
68
80
  }
@@ -1,3 +1,4 @@
1
+ import type { AnimojiSvgData } from '@vkontakte/calls-vmoji';
1
2
  import BaseSignaling from '../../abstract/BaseSignaling';
2
3
  import { ParticipantId } from '../../types/Participant';
3
4
  import ServerSettings from '../../types/ServerSettings';
@@ -14,6 +15,10 @@ export default class ServerTransport extends EventEmitter {
14
15
  private _producerScreen;
15
16
  private _consumerScreen;
16
17
  private _asr;
18
+ private _animojiDataChannel;
19
+ private _animojiReceiver;
20
+ private _animojiSender;
21
+ private _animojiSvgDataByParticipantId;
17
22
  private _isOpen;
18
23
  private _observer;
19
24
  private _reconnectionPrevented;
@@ -36,7 +41,7 @@ export default class ServerTransport extends EventEmitter {
36
41
  private _rtpReceiversByStreamId;
37
42
  private _producerSessionId;
38
43
  private _newAudioShareTrack;
39
- constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings);
44
+ constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, animojiSvgDataByParticipantId?: Record<ParticipantId, AnimojiSvgData>);
40
45
  getState(): TransportState;
41
46
  updateStatisticsInterval(): void;
42
47
  open(observer?: boolean): void;
@@ -45,6 +50,7 @@ export default class ServerTransport extends EventEmitter {
45
50
  preventRestart(): void;
46
51
  allowRestart(): void;
47
52
  updateSettings(settings: ServerSettings): void;
53
+ setAnimojiSvg(participantId: ParticipantId, svgData: AnimojiSvgData): void;
48
54
  private _closeConnection;
49
55
  private static _closeDataChannel;
50
56
  private _createDataChannel;
@@ -60,8 +66,13 @@ export default class ServerTransport extends EventEmitter {
60
66
  private _removeCaptureSender;
61
67
  private _createCaptureReceiver;
62
68
  private _removeCaptureReceiver;
69
+ private _createAnimojiSender;
70
+ private _removeAnimojiSender;
71
+ private _createAnimojiReceiver;
72
+ private _removeAnimojiReceiver;
63
73
  private _applyConsumerSettings;
64
74
  private _onScreenSharingStatus;
75
+ private _onAnimojiStatus;
65
76
  private _setState;
66
77
  private _startStatInterval;
67
78
  private _stopStatInterval;
@@ -1,3 +1,4 @@
1
+ import type { AnimojiSvgData } from '@vkontakte/calls-vmoji/types';
1
2
  import BaseSignaling from '../../abstract/BaseSignaling';
2
3
  import { ParticipantId } from '../../types/Participant';
3
4
  import ServerSettings from '../../types/ServerSettings';
@@ -17,7 +18,8 @@ export declare const enum TransportEvent {
17
18
  TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED",
18
19
  NETWORK_STATUS = "NETWORK_STATUS",
19
20
  PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED",
20
- ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION"
21
+ ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION",
22
+ ANIMOJI_STREAM = "ANIMOJI_STREAM"
21
23
  }
22
24
  export declare const enum TransportState {
23
25
  IDLE = "IDLE",
@@ -45,6 +47,7 @@ export declare class Transport extends EventEmitter {
45
47
  private _stListeners;
46
48
  private _states;
47
49
  private _localState;
50
+ private _animojiSvgDataByParticipantId;
48
51
  constructor(topology: TransportTopology, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings);
49
52
  updateSettings(settings: ServerSettings): void;
50
53
  updateStatisticsInterval(): void;
@@ -57,6 +60,7 @@ export declare class Transport extends EventEmitter {
57
60
  allocated(): string[];
58
61
  opened(): string[];
59
62
  getState(): TransportState;
63
+ setAnimojiSvg(participantId: ParticipantId, svgData: AnimojiSvgData): void;
60
64
  private _setStates;
61
65
  private _setState;
62
66
  private _setLocalState;
@@ -83,5 +87,6 @@ export declare class Transport extends EventEmitter {
83
87
  private _onServerRemoteTrackAdded;
84
88
  private _onServerRemoteTrackRemoved;
85
89
  private _onAsrTranscription;
90
+ private _onAnimojiStream;
86
91
  getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
87
92
  }
@@ -3,6 +3,7 @@ declare const enum DataChannelLabel {
3
3
  producerCommand = "producerCommand",
4
4
  consumerScreenShare = "consumerScreenShare",
5
5
  producerScreenShare = "producerScreenShare",
6
- asr = "asr"
6
+ asr = "asr",
7
+ animoji = "animoji"
7
8
  }
8
9
  export default DataChannelLabel;
@@ -6,6 +6,7 @@ declare enum MediaOption {
6
6
  VIDEO = "VIDEO",
7
7
  SCREEN_SHARING = "SCREEN_SHARING",
8
8
  MOVIE_SHARING = "MOVIE_SHARING",
9
- AUDIO_SHARING = "AUDIO_SHARING"
9
+ AUDIO_SHARING = "AUDIO_SHARING",
10
+ ANIMOJI = "ANIMOJI"
10
11
  }
11
12
  export default MediaOption;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.3-dev.df409e1.0",
3
+ "version": "2.6.3-dev.e77d93a.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",
@@ -15,6 +15,7 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "@vkontakte/calls-video-effects": "1.0.6-beta.18",
18
+ "@vkontakte/calls-vmoji": "1.0.5-beta.2",
18
19
  "@vkontakte/libvpx": "2.0.9",
19
20
  "bit-buffer": "0.2.5",
20
21
  "messagepack": "1.1.12",
@@ -1,4 +1,5 @@
1
1
  import type { VideoEffects } from '@vkontakte/calls-video-effects';
2
+ import type * as Vmoji from '@vkontakte/calls-vmoji';
2
3
  import { ConversationData } from '../classes/Conversation';
3
4
  import HangupReason from '../classes/HangupReason';
4
5
  import { MediaTrackKind } from '../classes/MediaSource';
@@ -143,6 +144,12 @@ export declare type ParamsObject = {
143
144
  * _По умолчанию: `480`_
144
145
  */
145
146
  videoEffectMaxHeight: number;
147
+ /**
148
+ * Экземпляр класса `Vmoji` из `@vkontakte/calls-vmoji`
149
+ *
150
+ * Можно установить позднее методом `setVmoji`
151
+ */
152
+ vmoji: typeof Vmoji | null;
146
153
  iceRestartWaitTime: number;
147
154
  transportConnectionWaitTime: number;
148
155
  /**
@@ -324,6 +331,9 @@ export declare type ParamsObject = {
324
331
  /** таймаут для батчинга на получение externalId */
325
332
  userIdsByOkBatchedTimeout: number;
326
333
  };
334
+ fastScreenShareFrameRate: number;
335
+ fastScreenShareWidth: number;
336
+ fastScreenShareHeight: number;
327
337
  /**
328
338
  * Получен локальный стрим с камеры/микрофона
329
339
  */
@@ -657,7 +667,6 @@ export default abstract class Params {
657
667
  static get videoAspectRatio(): number;
658
668
  static get videoFrameRate(): number;
659
669
  static get videoFacingMode(): FacingMode;
660
- static get screenFrameRate(): number;
661
670
  static get displaySurface(): DisplayCaptureSurfaceType;
662
671
  static get videoEffects(): VideoEffects | null;
663
672
  static set videoEffects(value: VideoEffects | null);
@@ -665,6 +674,9 @@ export default abstract class Params {
665
674
  static set videoEffectMaxWidth(value: number);
666
675
  static get videoEffectMaxHeight(): number;
667
676
  static set videoEffectMaxHeight(value: number);
677
+ static get useVmoji(): boolean;
678
+ static get vmoji(): typeof Vmoji | null;
679
+ static set vmoji(value: typeof Vmoji | null);
668
680
  static get voiceParams(): {
669
681
  [key: string]: number;
670
682
  };
@@ -713,4 +725,7 @@ export default abstract class Params {
713
725
  /** таймаут для батчинга на получение externalId */
714
726
  userIdsByOkBatchedTimeout: number;
715
727
  };
728
+ static get fastScreenShareWidth(): number;
729
+ static get fastScreenShareHeight(): number;
730
+ static getScreenFrameRate(fastScreenShare: boolean): number;
716
731
  }
@@ -50,7 +50,7 @@ declare class MediaConstraints {
50
50
  */
51
51
  export declare class ScreenConstraints extends MediaConstraints {
52
52
  readonly captureController: CaptureController | null;
53
- constructor(width: number, height: number, withAudioShare: boolean);
53
+ constructor(width: number, height: number, frameRate: number, withAudioShare: boolean);
54
54
  getNative(): object;
55
55
  }
56
56
  declare namespace WebRTCUtils {
@@ -109,7 +109,7 @@ declare namespace WebRTCUtils {
109
109
  /**
110
110
  * Запрашивает трансляцию экрана пользователя с опциональным захватом звука
111
111
  */
112
- function getScreenMedia(withAudioShare: boolean): Promise<MediaStream>;
112
+ function getScreenMedia(fastScreenShare: boolean, withAudioShare: boolean): Promise<MediaStream>;
113
113
  /**
114
114
  * Запрашивает камеру пользователя
115
115
  *
@@ -14,10 +14,18 @@ export declare type MediaSettings = {
14
14
  * Включена ли трансляция экрана
15
15
  */
16
16
  isScreenSharingEnabled: boolean;
17
+ /**
18
+ * Режим динамического контента при трансляция экрана (быстрая шара)
19
+ */
20
+ isFastScreenSharingEnabled: boolean;
17
21
  /**
18
22
  * Включена ли трансляция звука
19
23
  */
20
24
  isAudioSharingEnabled: boolean;
25
+ /**
26
+ * Включена ли трансляция вимоджи
27
+ */
28
+ isAnimojiEnabled: boolean;
21
29
  videoStreams: VideoStreamInfo[];
22
30
  };
23
31
  export declare type VideoStreamInfo = {
@@ -7,7 +7,8 @@ export declare enum MediaType {
7
7
  SCREEN = "SCREEN",
8
8
  STREAM = "STREAM",
9
9
  MOVIE = "MOVIE",
10
- AUDIOSHARE = "AUDIOSHARE"
10
+ AUDIOSHARE = "AUDIOSHARE",
11
+ ANIMOJI = "ANIMOJI"
11
12
  }
12
13
  export declare function serializeParticipantStreamDescription(description: ParticipantStreamDescription): string;
13
14
  export declare function parseParticipantStreamDescription(descriptionString: string): ParticipantStreamDescription;
@@ -0,0 +1,14 @@
1
+ export interface ScreenCaptureSettings {
2
+ /**
3
+ * Включить или выключить захват экрана.
4
+ */
5
+ captureScreen: boolean;
6
+ /**
7
+ * Режим динамического контента при трансляция экрана (быстрая шара).
8
+ */
9
+ fastScreenSharing: boolean;
10
+ /**
11
+ * Включить или выключить захват звука. Может быть использован только вместе с захватом экрана.
12
+ */
13
+ captureAudio: boolean;
14
+ }