@vkontakte/calls-sdk 2.5.3-dev.d006735.0 → 2.5.3-dev.fe8ad1c.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.
@@ -15,6 +15,7 @@ import { JSONObject } from '../static/Json';
15
15
  import { ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
16
16
  import MediaModifiers from '../types/MediaModifiers';
17
17
  import { IVideoDimentions } from '../types/MediaSettings';
18
+ import { IAddMovieParams } from '../types/MovieShare';
18
19
  import MuteStates from '../types/MuteStates';
19
20
  import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
20
21
  import { ParticipantLayout } from '../types/ParticipantLayout';
@@ -191,6 +192,7 @@ export default class Conversation extends EventEmitter {
191
192
  private _onParticipantSourcesUpdate;
192
193
  private _onParticipantPromoted;
193
194
  private _onChatRoomUpdated;
195
+ private _onSharedMovieUpdate;
194
196
  private _waitForStreamIfNeeded;
195
197
  private _matchStreamDescription;
196
198
  private _getWaitingTime;
@@ -214,7 +216,7 @@ export default class Conversation extends EventEmitter {
214
216
  customData(data: JSONObject, participantId?: ParticipantId | null): Promise<void>;
215
217
  createJoinLink(): Promise<string>;
216
218
  removeJoinLink(): Promise<never>;
217
- addMovie(movieId: string): Promise<{
219
+ addMovie({ movieId, gain }: IAddMovieParams): Promise<{
218
220
  movieId: string;
219
221
  streamType: string;
220
222
  }>;
@@ -278,7 +280,6 @@ export default class Conversation extends EventEmitter {
278
280
  private _onRemoteTrackRemoved;
279
281
  private _removeAudioTrack;
280
282
  private _removeVideoTrack;
281
- private _onRemoteActivityNoSignal;
282
283
  private _onTopologyChanged;
283
284
  private _onRemoteAllStall;
284
285
  private _onRemoteSignalledStall;
@@ -1,6 +1,6 @@
1
1
  import { ParticipantId } from '../types/Participant';
2
2
  import EventEmitter from './EventEmitter';
3
- import { Transport } from './transport/Transport';
3
+ import { Transport, TransportTopology } from './transport/Transport';
4
4
  import { VolumeLevel } from './VolumeDetector';
5
5
  import { VolumesDetector } from './VolumesDetector';
6
6
  export declare const enum SpeakerDetectorEvent {
@@ -8,13 +8,12 @@ export declare const enum SpeakerDetectorEvent {
8
8
  }
9
9
  export declare class SpeakerDetector extends EventEmitter {
10
10
  private _speakerId;
11
- private _serverAudioActivityAvailable;
12
- constructor(volumesDetector: VolumesDetector, transport: Transport);
11
+ private _serverSideSpeakerDetection;
12
+ constructor(volumesDetector: VolumesDetector, transport: Transport, topology: TransportTopology);
13
13
  destroy(): void;
14
14
  _onVolumesDetected(volumes: {
15
15
  [key: string]: VolumeLevel;
16
16
  }): void;
17
17
  _onServerSpeakerChanged(speakerId: ParticipantId): void;
18
- _onReceivedServerAudioActivity(): void;
19
- _onStoppedReceivingServerAudioActivity(): void;
18
+ private _onTopologyChanged;
20
19
  }
@@ -13,5 +13,5 @@ export declare class VolumesDetector extends EventEmitter {
13
13
  private _onRemoteTrackRemoved;
14
14
  private _collectVolumes;
15
15
  private _onSignalledActiveParticipants;
16
- private _onActiveParticipantsNoSignal;
16
+ private _onTopologyChanged;
17
17
  }
@@ -1,5 +1,5 @@
1
1
  export default interface IDecoder {
2
- init(onFrameImage: (image: ImageBitmap | ImageData) => void): Promise<void>;
2
+ init(onFrameImage: (image: VideoFrame | ImageBitmap | ImageData) => void): Promise<void>;
3
3
  decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
4
4
  destroy(): void;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import IDecoder from './IDecoder';
2
2
  import WorkerBase from './WorkerBase';
3
3
  export default class WebCodecsDecoder extends WorkerBase implements IDecoder {
4
- init(onFrameImage: (image: ImageBitmap) => void): Promise<void>;
4
+ init(onFrameImage: (frame: VideoFrame) => void): Promise<void>;
5
5
  decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
6
6
  destroy(): void;
7
7
  static isBrowserSupported(): boolean;
@@ -0,0 +1,8 @@
1
+ export default abstract class BaseRenderer {
2
+ protected readonly _onStream: (stream: MediaStream) => void;
3
+ protected constructor(onStream: (stream: MediaStream) => void);
4
+ drawFrame(frame: VideoFrame): Promise<void>;
5
+ drawImage(image: ImageBitmap | ImageData): void;
6
+ abstract destroy(): void;
7
+ static isBrowserSupported(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ import BaseRenderer from './BaseRenderer';
2
+ export default class CanvasRenderer extends BaseRenderer {
3
+ private readonly _useImageBitmap;
4
+ private _canvas;
5
+ private _canvasContext;
6
+ private _stream;
7
+ private _track;
8
+ constructor(onStream: (stream: MediaStream) => void);
9
+ private _createStream;
10
+ private _removeStream;
11
+ private _requestCanvasFrame;
12
+ drawFrame(frame: VideoFrame): Promise<void>;
13
+ drawImage(image: ImageBitmap | ImageData): void;
14
+ destroy(): void;
15
+ static isBrowserSupported(): boolean;
16
+ }
@@ -1,19 +1,11 @@
1
1
  import { ParticipantId } from '../../types/Participant';
2
2
  import { BaseStreamBuilder, FrameData } from './BaseStreamBuilder';
3
3
  export default class StreamBuilder extends BaseStreamBuilder {
4
+ private readonly _renderer;
4
5
  private readonly _decoder;
5
6
  private _decoderReady;
6
7
  private _decoderQueue;
7
- private readonly _useImageBitmap;
8
- private _canvas;
9
- private _canvasContext;
10
- private _stream;
11
- private _track;
12
8
  constructor(participantId: ParticipantId, onStream: (stream: MediaStream) => void);
13
- private _createStream;
14
- private _removeStream;
15
- private _requestCanvasFrame;
16
- private _drawImage;
17
9
  protected _processFrame(frame: FrameData): void;
18
10
  private _decodeQueue;
19
11
  destroy(): void;
@@ -0,0 +1,10 @@
1
+ import BaseRenderer from './BaseRenderer';
2
+ export default class TrackGeneratorRenderer extends BaseRenderer {
3
+ private readonly _generator;
4
+ private readonly _writer;
5
+ private readonly _stream;
6
+ constructor(onStream: (stream: MediaStream) => void);
7
+ drawFrame(frame: VideoFrame): Promise<void>;
8
+ destroy(): void;
9
+ static isBrowserSupported(): boolean;
10
+ }
@@ -12,7 +12,6 @@ export declare const enum TransportEvent {
12
12
  STATE_CHANGED = "STATE_CHANGED",
13
13
  LOCAL_STATE_CHANGED = "LOCAL_STATE_CHANGED",
14
14
  SIGNALLED_ACTIVE_PARTICIPANTS = "SIGNALLED_ACTIVE_PARTICIPANTS",
15
- ACTIVE_PARTICIPANTS_NO_SIGNAL = "ACTIVE_PARTICIPANTS_NO_SIGNAL",
16
15
  SIGNALLED_SPEAKER_CHANGED = "SIGNALLED_SPEAKER_CHANGED",
17
16
  SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS",
18
17
  TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED",
@@ -69,7 +68,6 @@ export declare class Transport extends EventEmitter {
69
68
  private _setLocalNoiseSuppression;
70
69
  private _onDirectTransportChanged;
71
70
  private _onServerTransportChanged;
72
- private _onTransportActiveParticipantsNoSignal;
73
71
  private _onTransportActiveParticipants;
74
72
  private _onTransportStalledParticipants;
75
73
  private _onTransportSpeakerChanged;
@@ -1,4 +1,4 @@
1
- declare const enum CallDirection {
1
+ declare enum CallDirection {
2
2
  INCOMING = "INCOMING",
3
3
  OUTGOING = "OUTGOING",
4
4
  JOINING = "JOINING"
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Разрешение на включение устройства
3
3
  */
4
- declare const enum MuteState {
4
+ declare enum MuteState {
5
5
  UNMUTE = "UNMUTE",
6
6
  MUTE = "MUTE",
7
7
  MUTE_PERMANENT = "MUTE_PERMANENT"
@@ -1,4 +1,4 @@
1
- declare const enum ParticipantState {
1
+ declare enum ParticipantState {
2
2
  CALLED = "CALLED",
3
3
  ACCEPTED = "ACCEPTED",
4
4
  REJECTED = "REJECTED",
@@ -1,4 +1,4 @@
1
- declare const enum SignalingNotification {
1
+ declare enum SignalingNotification {
2
2
  TRANSMITTED_DATA = "transmitted-data",
3
3
  ACCEPTED_CALL = "accepted-call",
4
4
  HUNGUP = "hungup",
@@ -35,6 +35,7 @@ declare const enum SignalingNotification {
35
35
  PROMOTE_PARTICIPANT = "promote-participant",
36
36
  CHAT_ROOM_UPDATED = "chat-room-updated",
37
37
  PROMOTION_APPROVED = "promotion-approved",
38
- JOIN_LINK_CHANGED = "join-link-changed"
38
+ JOIN_LINK_CHANGED = "join-link-changed",
39
+ MOVIE_UPDATE_NOTIFICATION = "movie-update-notification"
39
40
  }
40
41
  export default SignalingNotification;
@@ -1,4 +1,4 @@
1
- declare const enum UserType {
1
+ declare enum UserType {
2
2
  USER = "USER",
3
3
  GROUP = "GROUP"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.5.3-dev.d006735.0",
3
+ "version": "2.5.3-dev.fe8ad1c.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",
@@ -16,7 +16,6 @@
16
16
  "dependencies": {
17
17
  "@vkontakte/calls-video-effects": "1.0.6-beta.18",
18
18
  "@vkontakte/libvpx": "2.0.9",
19
- "big-integer": "1.6.48",
20
19
  "bit-buffer": "0.2.5",
21
20
  "messagepack": "1.1.12",
22
21
  "simple-ebml-builder": "0.2.2",
@@ -10,6 +10,7 @@ import UserRole from '../enums/UserRole';
10
10
  import { ExternalId, ExternalParticipant, ExternalParticipantId } from '../types/ExternalId';
11
11
  import MediaModifiers from '../types/MediaModifiers';
12
12
  import MediaSettings from '../types/MediaSettings';
13
+ import { ISharedMovieState } from '../types/MovieShare';
13
14
  import MuteStates from '../types/MuteStates';
14
15
  import { ParticipantStateMapped } from '../types/Participant';
15
16
  import { DebugMessageType } from './Debug';
@@ -76,6 +77,29 @@ declare namespace External {
76
77
  * @param stream
77
78
  */
78
79
  function onRemoteLive(userId: ExternalParticipantId, streamName: string, stream: MediaStream | null): void;
80
+ /**
81
+ * Получен собственный стрим лайв.
82
+ * Если сервер закончил стримить собеседника, вместо стрима будет передан null
83
+ *
84
+ * @param userId
85
+ * @param streamName
86
+ * @param stream
87
+ */
88
+ function onLocalLive(userId: ExternalParticipantId, streamName: string, stream: MediaStream | null): void;
89
+ /**
90
+ * Получено обновление стрима или лайва от собеседника.
91
+ *
92
+ * @param userId
93
+ * @param data
94
+ */
95
+ function onRemoteLiveUpdate(userId: ExternalParticipantId, data: ISharedMovieState): void;
96
+ /**
97
+ * Получено обновление собственного стрима или лайва.
98
+ *
99
+ * @param userId
100
+ * @param data
101
+ */
102
+ function onLocalLiveUpdate(userId: ExternalParticipantId, data: ISharedMovieState): void;
79
103
  /**
80
104
  * Получен стрим с экрана собеседника.
81
105
  * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
@@ -106,9 +130,7 @@ declare namespace External {
106
130
  * @param userId
107
131
  * @param participantState
108
132
  */
109
- function onRemoteParticipantState(userId: ExternalParticipantId, participantState: {
110
- [key: string]: string;
111
- } | ParticipantStateMapped): void;
133
+ function onRemoteParticipantState(userId: ExternalParticipantId, participantState: ParticipantStateMapped): void;
112
134
  /**
113
135
  * Изменился статус соединения собеседников
114
136
  *
@@ -321,5 +343,11 @@ declare namespace External {
321
343
  * @param firstParticipants Первые несколько ожидающих в зале
322
344
  */
323
345
  function onChatRoomUpdated(eventType: ChatRoomEventType, totalCount: number, firstParticipants: ExternalId[]): void;
346
+ /**
347
+ * Получен микшированный аудио стрим.
348
+ *
349
+ * @param stream стрим от WebRTC
350
+ */
351
+ function onRemoteMixedAudioStream(stream: MediaStream): void;
324
352
  }
325
353
  export default External;
@@ -12,6 +12,7 @@ import IceServer from '../types/IceServer';
12
12
  import MediaModifiers from '../types/MediaModifiers';
13
13
  import MediaSettings from '../types/MediaSettings';
14
14
  import MuteStates from '../types/MuteStates';
15
+ import { ParticipantStateMapped } from '../types/Participant';
15
16
  import AuthData from './AuthData';
16
17
  import { DebugMessageType } from './Debug';
17
18
  import { ParticipantStatus } from './External';
@@ -230,8 +231,24 @@ export declare type ParamsObject = {
230
231
  * @hidden
231
232
  */
232
233
  batchParticipantsOnStart: boolean;
233
- participantStateMapped: boolean;
234
234
  joinFromMultipleDevices: boolean;
235
+ /**
236
+ * Фильтровать наблюдателей во всех колбэках
237
+ * @hidden
238
+ */
239
+ filterObservers: boolean;
240
+ /**
241
+ * Отключить звук собеседников
242
+ * @hidden
243
+ */
244
+ muteMode: boolean;
245
+ /**
246
+ * Сохранять (не удалять) аудио дорожки в стримах, поступающих клиенту
247
+ * Позволяет клиенту получать и сохранять аудио данные
248
+ * Внимание: может привести к "двойному" звуку при проигрывании
249
+ * @hidden
250
+ */
251
+ preserveAudioTracks: boolean;
235
252
  /**
236
253
  * Получен локальный стрим с камеры/микрофона
237
254
  */
@@ -263,6 +280,11 @@ export declare type ParamsObject = {
263
280
  * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
264
281
  */
265
282
  onRemoteLive?: (userId: ExternalParticipantId, streamId: string, stream: MediaStream | null) => void;
283
+ /**
284
+ * Получен собственный стрим трансляция или мувик.
285
+ * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
286
+ */
287
+ onLocalLive?: (userId: ExternalParticipantId, streamId: string, stream: MediaStream | null) => void;
266
288
  /**
267
289
  * Начат звонок
268
290
  */
@@ -274,9 +296,7 @@ export declare type ParamsObject = {
274
296
  /**
275
297
  * Изменились данные состояний собеседника
276
298
  */
277
- onRemoteParticipantState?: (userId: ExternalParticipantId, participantState: {
278
- [key: string]: string;
279
- }) => void;
299
+ onRemoteParticipantState?: (userId: ExternalParticipantId, participantState: ParticipantStateMapped) => void;
280
300
  /**
281
301
  * Изменился статус соединения собеседников
282
302
  */
@@ -419,6 +439,12 @@ export declare type ParamsObject = {
419
439
  * @param firstParticipants Первые несколько ожидающих в зале
420
440
  */
421
441
  onChatRoomUpdated?: (eventType: ChatRoomEventType, totalCount: number, firstParticipants: ExternalId[]) => void;
442
+ /**
443
+ * Получен микшированный аудио стрим.
444
+ * @hidden
445
+ * @param stream стрим от WebRTC
446
+ */
447
+ onRemoteMixedAudioStream?: (stream: MediaStream) => void;
422
448
  };
423
449
  export default abstract class Params {
424
450
  private static _params;
@@ -509,5 +535,7 @@ export default abstract class Params {
509
535
  static get serverAudioRed(): boolean;
510
536
  static get p2pAudioRed(): boolean;
511
537
  static get batchParticipantsOnStart(): boolean;
512
- static get participantStateMapped(): boolean;
538
+ static get filterObservers(): boolean;
539
+ static get muteMode(): boolean;
540
+ static get preserveAudioTracks(): boolean;
513
541
  }
package/static/Utils.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { BigInteger } from 'big-integer';
2
1
  import UserType from '../enums/UserType';
3
2
  import { ExternalParticipant } from '../types/ExternalId';
4
3
  import { CompositeUserId, OkUserId, Participant, ParticipantId, ParticipantStateMapped } from '../types/Participant';
@@ -26,7 +25,7 @@ declare namespace Utils {
26
25
  };
27
26
  function uuid(): string;
28
27
  function throttle(func: Function, ms: number): (this: any) => void;
29
- function sdpFingerprint(sdp: string): BigInteger;
28
+ function sdpFingerprint(sdp: string): bigint | null;
30
29
  function delay(time: number): Promise<unknown>;
31
30
  function applySettings(pc: RTCPeerConnection, videoSettings: VideoSettings, prevSettings: any): any;
32
31
  function applyVideoTrackSettings(videoSettings: VideoSettings, s: RTCRtpSender, track: MediaStreamTrack | null, prevSettings: any, retSettings: any): void;
@@ -41,13 +40,6 @@ declare namespace Utils {
41
40
  * @param participant список участников звонка
42
41
  */
43
42
  function mapParticipantState(participant: Pick<SignalingMessage.Participant, 'participantState'>): ParticipantStateMapped;
44
- /**
45
- * Legacy маппер клиентского состояния участника звонка (когда `state` вида `{ [key: string]: string }`)
46
- * @param participantState состояние участника
47
- */
48
- function mapLegacyParticipantState(participantState: ParticipantStateMapped): {
49
- [key: string]: string;
50
- };
51
43
  /**
52
44
  * мапает данные `participants` перед передачей клиенту
53
45
  */
@@ -6,5 +6,9 @@ declare type ConversationParams = {
6
6
  stun_server?: IceServer;
7
7
  client_type?: string;
8
8
  device_idx?: number;
9
+ isp_as_no?: number;
10
+ isp_as_org?: string;
11
+ loc_cc?: string;
12
+ loc_reg?: string;
9
13
  };
10
14
  export default ConversationParams;
@@ -42,6 +42,11 @@ export interface ExternalId {
42
42
  * Тип пользователя
43
43
  */
44
44
  type: ExternalIdType;
45
+ /**
46
+ * Пользователь является наблюдателем звонка
47
+ * @hidden
48
+ */
49
+ observer?: boolean;
45
50
  }
46
51
  /**
47
52
  * Идентификатор участника звонка
@@ -0,0 +1,16 @@
1
+ import { ParticipantId } from './Participant';
2
+ export interface IAddMovieParams {
3
+ movieId: string;
4
+ gain?: number;
5
+ }
6
+ declare type Gain = number | null;
7
+ declare type Offset = number | null;
8
+ export declare type ISharedMovieStateResponse = [number, Gain, boolean, Offset, number];
9
+ export interface ISharedMovieState {
10
+ participantId: ParticipantId;
11
+ gain: Gain;
12
+ pause: boolean;
13
+ offset: Offset;
14
+ duration: number;
15
+ }
16
+ export {};
@@ -46,4 +46,5 @@ export interface Participant {
46
46
  };
47
47
  muteStates: MuteStates;
48
48
  unmuteOptions: MediaOption[];
49
+ observedIds: CompositeUserId[];
49
50
  }
@@ -9,8 +9,9 @@ import UserRole from '../enums/UserRole';
9
9
  import UserType from '../enums/UserType';
10
10
  import MediaModifiers from './MediaModifiers';
11
11
  import MediaSettings from './MediaSettings';
12
+ import { ISharedMovieState } from './MovieShare';
12
13
  import MuteStates from './MuteStates';
13
- import { OkUserId, ParticipantId } from './Participant';
14
+ import { CompositeUserId, OkUserId, ParticipantId } from './Participant';
14
15
  import VideoSettings from './VideoSettings';
15
16
  import { WaitingParticipant } from './WaitingHall';
16
17
  declare type SignalingMessage = Record<string, any>;
@@ -31,6 +32,12 @@ declare namespace SignalingMessage {
31
32
  id: number;
32
33
  type?: string;
33
34
  }
35
+ export type ParticipantListType = 'GRID' | 'SIDE' | 'ADMIN';
36
+ export interface ParticipantListMarker {
37
+ rank: number;
38
+ ts: number;
39
+ id?: CompositeUserId;
40
+ }
34
41
  export interface Participant {
35
42
  id: OkUserId;
36
43
  idType?: UserType;
@@ -50,6 +57,8 @@ declare namespace SignalingMessage {
50
57
  restricted?: boolean;
51
58
  muteStates?: MuteStates;
52
59
  unmuteOptions?: MediaOption[];
60
+ markers?: Record<ParticipantListType, ParticipantListMarker>;
61
+ observedIds?: CompositeUserId[];
53
62
  }
54
63
  interface Conversation {
55
64
  id: string;
@@ -255,6 +264,9 @@ declare namespace SignalingMessage {
255
264
  peerId: PeerId;
256
265
  mediaModifiers: MediaModifiers;
257
266
  }
267
+ export interface SharedMovieState extends Notification {
268
+ data: ISharedMovieState[];
269
+ }
258
270
  export {};
259
271
  }
260
272
  export default SignalingMessage;