@vkontakte/calls-sdk 2.5.3-dev.6fa8b9b.0 → 2.5.3-dev.943d867.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;
@@ -35,6 +35,7 @@ declare 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.5.3-dev.6fa8b9b.0",
3
+ "version": "2.5.3-dev.943d867.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",
@@ -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
@@ -319,5 +343,11 @@ declare namespace External {
319
343
  * @param firstParticipants Первые несколько ожидающих в зале
320
344
  */
321
345
  function onChatRoomUpdated(eventType: ChatRoomEventType, totalCount: number, firstParticipants: ExternalId[]): void;
346
+ /**
347
+ * Получен микшированный аудио стрим.
348
+ *
349
+ * @param stream стрим от WebRTC
350
+ */
351
+ function onRemoteMixedAudioStream(stream: MediaStream): void;
322
352
  }
323
353
  export default External;
@@ -11,6 +11,7 @@ import { ExternalId, ExternalParticipant, ExternalParticipantId } from '../types
11
11
  import IceServer from '../types/IceServer';
12
12
  import MediaModifiers from '../types/MediaModifiers';
13
13
  import MediaSettings from '../types/MediaSettings';
14
+ import { ISharedMovieState } from '../types/MovieShare';
14
15
  import MuteStates from '../types/MuteStates';
15
16
  import { ParticipantStateMapped } from '../types/Participant';
16
17
  import AuthData from './AuthData';
@@ -242,6 +243,13 @@ export declare type ParamsObject = {
242
243
  * @hidden
243
244
  */
244
245
  muteMode: boolean;
246
+ /**
247
+ * Сохранять (не удалять) аудио дорожки в стримах, поступающих клиенту
248
+ * Позволяет клиенту получать и сохранять аудио данные
249
+ * Внимание: может привести к "двойному" звуку при проигрывании
250
+ * @hidden
251
+ */
252
+ preserveAudioTracks: boolean;
245
253
  /**
246
254
  * Получен локальный стрим с камеры/микрофона
247
255
  */
@@ -273,6 +281,19 @@ export declare type ParamsObject = {
273
281
  * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
274
282
  */
275
283
  onRemoteLive?: (userId: ExternalParticipantId, streamId: string, stream: MediaStream | null) => void;
284
+ /**
285
+ * Получен собственный стрим трансляция или мувик.
286
+ * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
287
+ */
288
+ onLocalLive?: (userId: ExternalParticipantId, streamId: string, stream: MediaStream | null) => void;
289
+ /**
290
+ * Получено обновление стрима или лайва от собеседника.
291
+ */
292
+ onRemoteLiveUpdate?: (userId: ExternalParticipantId, data: ISharedMovieState) => void;
293
+ /**
294
+ * Получено обновление собственного стрима или лайва.
295
+ */
296
+ onLocalLiveUpdate?: (userId: ExternalParticipantId, data: ISharedMovieState) => void;
276
297
  /**
277
298
  * Начат звонок
278
299
  */
@@ -427,6 +448,12 @@ export declare type ParamsObject = {
427
448
  * @param firstParticipants Первые несколько ожидающих в зале
428
449
  */
429
450
  onChatRoomUpdated?: (eventType: ChatRoomEventType, totalCount: number, firstParticipants: ExternalId[]) => void;
451
+ /**
452
+ * Получен микшированный аудио стрим.
453
+ * @hidden
454
+ * @param stream стрим от WebRTC
455
+ */
456
+ onRemoteMixedAudioStream?: (stream: MediaStream) => void;
430
457
  };
431
458
  export default abstract class Params {
432
459
  private static _params;
@@ -519,4 +546,5 @@ export default abstract class Params {
519
546
  static get batchParticipantsOnStart(): boolean;
520
547
  static get filterObservers(): boolean;
521
548
  static get muteMode(): boolean;
549
+ static get preserveAudioTracks(): boolean;
522
550
  }
@@ -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;
@@ -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 {};
@@ -9,6 +9,7 @@ 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
14
  import { CompositeUserId, OkUserId, ParticipantId } from './Participant';
14
15
  import VideoSettings from './VideoSettings';
@@ -263,6 +264,9 @@ declare namespace SignalingMessage {
263
264
  peerId: PeerId;
264
265
  mediaModifiers: MediaModifiers;
265
266
  }
267
+ export interface SharedMovieState extends Notification {
268
+ data: ISharedMovieState[];
269
+ }
266
270
  export {};
267
271
  }
268
272
  export default SignalingMessage;