@vkontakte/calls-sdk 2.6.2-beta.20 → 2.6.2-beta.22

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.
@@ -12,6 +12,7 @@ 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 { IFeaturesPerRole } from '../types/ConversationFeature';
15
16
  import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
16
17
  import MediaModifiers from '../types/MediaModifiers';
17
18
  import { IVideoDimentions } from '../types/MediaSettings';
@@ -38,7 +39,7 @@ export declare type ConversationData = {
38
39
  */
39
40
  acceptTime: number | null;
40
41
  features: ConversationFeature[];
41
- featuresPerRole?: Partial<Record<ConversationFeature, UserRole[]>> | null;
42
+ featuresPerRole?: IFeaturesPerRole | null;
42
43
  /**
43
44
  * ID звонка
44
45
  */
@@ -193,7 +194,7 @@ export default class Conversation extends EventEmitter {
193
194
  private _onAddParticipant;
194
195
  private _onRemoveParticipant;
195
196
  changeDevice(kind: MediaDeviceKind): Promise<void>;
196
- toggleScreenCapturing(enabled: boolean): Promise<void>;
197
+ toggleScreenCapturing(screenEnabled: boolean, audioShareEnabled: boolean): Promise<void>;
197
198
  setVideoStream(stream: MediaStream, isScreen?: boolean): Promise<void>;
198
199
  setAudioStream(stream: MediaStream): Promise<void>;
199
200
  toggleLocalVideo(enabled: boolean): Promise<void>;
@@ -205,6 +206,8 @@ export default class Conversation extends EventEmitter {
205
206
  requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
206
207
  requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
207
208
  updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
209
+ /** @async */
210
+ feedback(key: string): Promise<SignalingMessage>;
208
211
  private _stopStreaming;
209
212
  private _sendUpdateDisplayLayout;
210
213
  private _cleanupCooldownQueue;
@@ -216,6 +219,7 @@ export default class Conversation extends EventEmitter {
216
219
  private _processSharedMovieInfo;
217
220
  private _processConnectionSharedMovieInfo;
218
221
  private _onSharedMovieInfoStopped;
222
+ private _onFeaturesPerRoleChanged;
219
223
  private _waitForStreamIfNeeded;
220
224
  private _matchStreamDescription;
221
225
  private _getWaitingTime;
@@ -316,6 +320,8 @@ export default class Conversation extends EventEmitter {
316
320
  private _updateDisplayLayoutFromCache;
317
321
  private _setParticipantsStatus;
318
322
  private _onJoinLinkChanged;
323
+ /** получили из сингналинга сообщение о реакции пользователей */
324
+ private _onFeedback;
319
325
  private _isMe;
320
326
  }
321
327
  export declare class UpdateDisplayLayoutError extends Error {
@@ -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
  }
@@ -33,6 +33,7 @@ export default class ServerTransport extends EventEmitter {
33
33
  private _disabledSenders;
34
34
  private _rtpReceiversByStreamId;
35
35
  private _producerSessionId;
36
+ private _newAudioShareTrack;
36
37
  constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings);
37
38
  getState(): TransportState;
38
39
  updateStatisticsInterval(): void;
@@ -68,6 +69,7 @@ export default class ServerTransport extends EventEmitter {
68
69
  private _detectStaleTracks;
69
70
  private _allocateConsumer;
70
71
  private _acceptProducer;
72
+ private handleTracks;
71
73
  _onSignalingNotification(message: SignalingMessage): Promise<void>;
72
74
  private _onProducerUpdated;
73
75
  private _onAddTrack;
@@ -121,6 +121,7 @@ export default class Signaling extends BaseSignaling {
121
121
  }): Promise<SignalingMessage>;
122
122
  getWaitingHall(fromId?: WaitingParticipantId | null, count?: number, backward?: boolean): Promise<SignalingMessage>;
123
123
  promoteParticipant(participantId: CompositeUserId, demote?: boolean): Promise<SignalingMessage>;
124
+ feedback(key: string): Promise<SignalingMessage>;
124
125
  /**
125
126
  * Close a connection with a signaling server
126
127
  */
@@ -5,7 +5,8 @@ declare enum ConversationOption {
5
5
  REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN",
6
6
  AUDIENCE_MODE = "AUDIENCE_MODE",
7
7
  WAITING_HALL = "WAITING_HALL",
8
- ASR = "ASR"
8
+ ASR = "ASR",
9
+ FEEDBACK = "FEEDBACK"
9
10
  }
10
11
  export default ConversationOption;
11
12
  export declare function compareOptions(oldOptions: ConversationOption[], newOptions: ConversationOption[]): boolean;
@@ -5,6 +5,7 @@ declare enum MediaOption {
5
5
  AUDIO = "AUDIO",
6
6
  VIDEO = "VIDEO",
7
7
  SCREEN_SHARING = "SCREEN_SHARING",
8
- MOVIE_SHARING = "MOVIE_SHARING"
8
+ MOVIE_SHARING = "MOVIE_SHARING",
9
+ AUDIO_SHARING = "AUDIO_SHARING"
9
10
  }
10
11
  export default MediaOption;
@@ -35,6 +35,7 @@ declare enum SignalingCommandType {
35
35
  REQUEST_TEST_MODE = "request-test-mode",
36
36
  ADD_MOVIE = "add-movie",
37
37
  UPDATE_MOVIE = "update-movie",
38
- REMOVE_MOVIE = "remove-movie"
38
+ REMOVE_MOVIE = "remove-movie",
39
+ FEEDBACK = "feedback"
39
40
  }
40
41
  export default SignalingCommandType;
@@ -36,9 +36,11 @@ declare enum SignalingNotification {
36
36
  CHAT_ROOM_UPDATED = "chat-room-updated",
37
37
  PROMOTION_APPROVED = "promotion-approved",
38
38
  JOIN_LINK_CHANGED = "join-link-changed",
39
+ FEEDBACK = "feedback",
39
40
  MOVIE_UPDATE_NOTIFICATION = "movie-update-notification",
40
41
  MOVIE_SHARE_INFO = "movie-share-info",
41
42
  MOVIE_SHARE_STARTED = "movie-share-started",
42
- MOVIE_SHARE_STOPPED = "movie-share-stopped"
43
+ MOVIE_SHARE_STOPPED = "movie-share-stopped",
44
+ FEATURES_PER_ROLE_CHANGED = "features-per-role-changed"
43
45
  }
44
46
  export default SignalingNotification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.2-beta.20",
3
+ "version": "2.6.2-beta.22",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -7,7 +7,9 @@ import ConversationOption from '../enums/ConversationOption';
7
7
  import FatalError from '../enums/FatalError';
8
8
  import MediaOption from '../enums/MediaOption';
9
9
  import UserRole from '../enums/UserRole';
10
+ import { IFeaturesPerRole } from '../types/ConversationFeature';
10
11
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalParticipantListMarkers } from '../types/ExternalId';
12
+ import { IFeedbackExternal } from '../types/Feedback';
11
13
  import MediaModifiers from '../types/MediaModifiers';
12
14
  import MediaSettings from '../types/MediaSettings';
13
15
  import { IOnRemoteMovieData, ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from '../types/MovieShare';
@@ -412,5 +414,15 @@ declare namespace External {
412
414
  * @param joinLink токен присоединения к звонку
413
415
  */
414
416
  function onJoinLinkChanged(joinLink: string): void;
417
+ /**
418
+ * Получена новая реакция
419
+ */
420
+ function onFeedback(feedback: IFeedbackExternal[]): void;
421
+ /**
422
+ * Изменилось состояние пермиссий фич в звонке
423
+ *
424
+ * @param featuresPerRole Информация о доступных фичах по ролям
425
+ */
426
+ function onFeaturesPerRoleChanged(featuresPerRole: IFeaturesPerRole): void;
415
427
  }
416
428
  export default External;
@@ -7,7 +7,9 @@ import ConversationOption from '../enums/ConversationOption';
7
7
  import FatalError from '../enums/FatalError';
8
8
  import MediaOption from '../enums/MediaOption';
9
9
  import UserRole from '../enums/UserRole';
10
+ import { IFeaturesPerRole } from '../types/ConversationFeature';
10
11
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalParticipantListMarkers } from '../types/ExternalId';
12
+ import { IFeedbackExternal } from '../types/Feedback';
11
13
  import IceServer from '../types/IceServer';
12
14
  import MediaModifiers from '../types/MediaModifiers';
13
15
  import MediaSettings from '../types/MediaSettings';
@@ -523,6 +525,22 @@ export declare type ParamsObject = {
523
525
  * @param joinLink токен присоединения к звонку
524
526
  */
525
527
  onJoinLinkChanged?: (joinLink: string) => void;
528
+ /**
529
+ * Получены новые реакции в звонке
530
+ * @param feedback массив с реакциями
531
+ */
532
+ onFeedback?: (feedback: IFeedbackExternal[]) => void;
533
+ /**
534
+ * Включать capability c аудио шарой
535
+ */
536
+ audioShareCapabilityEnabled: boolean;
537
+ /**
538
+ * Изменился список ролей, которым доступны ConversationFeatures
539
+ *
540
+ * @param featuresPerRole Объект вида ключ: ConversationFeature = значение: UserRole[]
541
+ * (если ключ фичи отсутствует, или в ролях пустой массив, считаем фичу доступной для всех пользователей)
542
+ */
543
+ onFeaturesPerRoleChanged?: (featuresPerRole: IFeaturesPerRole) => void;
526
544
  };
527
545
  export default abstract class Params {
528
546
  private static _params;
@@ -624,4 +642,5 @@ export default abstract class Params {
624
642
  static get filterObservers(): boolean;
625
643
  static get muteMode(): boolean;
626
644
  static get preserveAudioTracks(): boolean;
645
+ static get audioShareCapabilityEnabled(): boolean;
627
646
  }
@@ -66,7 +66,7 @@ declare namespace WebRTCUtils {
66
66
  /**
67
67
  * Запрашивает трансляцию экрана пользователя
68
68
  */
69
- function getScreenMedia(): Promise<MediaStream>;
69
+ function getScreenMedia(withAudioShare: boolean): Promise<MediaStream>;
70
70
  /**
71
71
  * Запрашивает камеру пользователя
72
72
  *
@@ -146,5 +146,6 @@ declare namespace WebRTCUtils {
146
146
  * Возвращает подверсию браузера (если она есть)
147
147
  */
148
148
  function browserSubVersion(): string;
149
+ function isAudioShareSupported(): boolean;
149
150
  }
150
151
  export default WebRTCUtils;
@@ -0,0 +1,3 @@
1
+ import ConversationFeature from '../enums/ConversationFeature';
2
+ import UserRole from '../enums/UserRole';
3
+ export declare type IFeaturesPerRole = Partial<Record<ConversationFeature, UserRole[]>>;
@@ -0,0 +1,22 @@
1
+ import { CompositeUserId } from './Participant';
2
+ import { ExternalParticipantId } from './ExternalId';
3
+ interface IFeedbackItem {
4
+ participantId: CompositeUserId;
5
+ /** event timestamps for this participant, chronologically */
6
+ times: number[];
7
+ }
8
+ export interface IFeedbackItemExternal extends Omit<IFeedbackItem, 'participantId'> {
9
+ participantId: ExternalParticipantId;
10
+ }
11
+ export interface IFeedback {
12
+ /** feedback ID; key values should be negotiated by clients themselves, like in ParticipantState, and have just the same restrictions; on backend the values of these keys are not bound in any way to those in ParticipantState */
13
+ key: string;
14
+ /** total amount of reactions of this type from the start of this call */
15
+ totalCount: number;
16
+ /** list of items containing initiator & all related data, if any */
17
+ items: IFeedbackItem[];
18
+ }
19
+ export interface IFeedbackExternal extends Omit<IFeedback, 'items'> {
20
+ items: IFeedbackItemExternal[];
21
+ }
22
+ export {};
@@ -14,6 +14,10 @@ export declare type MediaSettings = {
14
14
  * Включена ли трансляция экрана
15
15
  */
16
16
  isScreenSharingEnabled: boolean;
17
+ /**
18
+ * Включена ли трансляция звука
19
+ */
20
+ isAudioSharingEnabled: boolean;
17
21
  videoStreams: VideoStreamInfo[];
18
22
  };
19
23
  export declare type VideoStreamInfo = {
@@ -6,7 +6,8 @@ export declare enum MediaType {
6
6
  CAMERA = "CAMERA",
7
7
  SCREEN = "SCREEN",
8
8
  STREAM = "STREAM",
9
- MOVIE = "MOVIE"
9
+ MOVIE = "MOVIE",
10
+ AUDIOSHARE = "AUDIOSHARE"
10
11
  }
11
12
  export declare function serializeParticipantStreamDescription(description: ParticipantStreamDescription): string;
12
13
  export declare function parseParticipantStreamDescription(descriptionString: string): ParticipantStreamDescription;
@@ -7,6 +7,8 @@ import MediaOption from '../enums/MediaOption';
7
7
  import ParticipantState from '../enums/ParticipantState';
8
8
  import UserRole from '../enums/UserRole';
9
9
  import UserType from '../enums/UserType';
10
+ import { IFeaturesPerRole } from './ConversationFeature';
11
+ import { IFeedback } from './Feedback';
10
12
  import MediaModifiers from './MediaModifiers';
11
13
  import MediaSettings from './MediaSettings';
12
14
  import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
@@ -74,7 +76,7 @@ declare namespace SignalingMessage {
74
76
  multichatId: string | null;
75
77
  tamtamMultichatId: string | null;
76
78
  recordInfo: RecordInfo | null;
77
- featuresPerRole?: Partial<Record<ConversationFeature, UserRole[]>> | null;
79
+ featuresPerRole?: IFeaturesPerRole | null;
78
80
  pinnedParticipantId: ParticipantId | null;
79
81
  options: ConversationOption[];
80
82
  muteStates?: MuteStates;
@@ -189,7 +191,7 @@ declare namespace SignalingMessage {
189
191
  }
190
192
  export interface FeatureSetChanged extends Notification {
191
193
  features: ConversationFeature[];
192
- featuresPerRole?: Partial<Record<ConversationFeature, UserRole[]>> | null;
194
+ featuresPerRole?: IFeaturesPerRole | null;
193
195
  }
194
196
  export interface MultipartyChatCreated extends Notification {
195
197
  chatId: string;
@@ -283,6 +285,9 @@ declare namespace SignalingMessage {
283
285
  export interface JoinLinkChanged extends Notification {
284
286
  joinLink: string;
285
287
  }
288
+ export interface Feedback extends Notification {
289
+ feedback: IFeedback[];
290
+ }
286
291
  export interface SharedMovieState extends Notification {
287
292
  data: ISharedMovieState[];
288
293
  }
@@ -291,6 +296,9 @@ declare namespace SignalingMessage {
291
296
  }
292
297
  export interface SharedMovieStoppedInfo extends Notification, ISharedMovieStoppedInfo {
293
298
  }
299
+ export interface FeaturesPerRoleChanged extends Notification {
300
+ featuresPerRole?: IFeaturesPerRole | null;
301
+ }
294
302
  export {};
295
303
  }
296
304
  export default SignalingMessage;
@@ -1,6 +1,7 @@
1
1
  import { ExternalId } from './ExternalId';
2
2
  import { CompositeUserId } from './Participant';
3
3
  import SignalingMessage from './SignalingMessage';
4
+ import { IFeedback } from './Feedback';
4
5
  export declare type WaitingParticipantId = {
5
6
  addedTs: number;
6
7
  id: CompositeUserId;
@@ -9,18 +10,11 @@ export declare type WaitingParticipant = {
9
10
  id: WaitingParticipantId;
10
11
  externalId?: SignalingMessage.ExternalId;
11
12
  };
12
- export declare type Feedback = {
13
- key: string;
14
- totalCount: number;
15
- currentCount: number;
16
- timeout: number;
17
- participantIds: CompositeUserId[];
18
- };
19
13
  export declare type ChatRoom = {
20
14
  totalCount: number;
21
15
  firstParticipants?: WaitingParticipant[];
22
16
  handCount?: number;
23
- feedback?: Feedback[];
17
+ feedback?: IFeedback[];
24
18
  };
25
19
  /**
26
20
  * Ответ на запрос `getWaitingHall`