@vkontakte/calls-sdk 2.7.2-beta.13 → 2.7.2-beta.15

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.
@@ -2,7 +2,6 @@ import type { IEffect } from '@vkontakte/calls-video-effects';
2
2
  import BaseApi from '../abstract/BaseApi';
3
3
  import BaseLogger from '../abstract/BaseLogger';
4
4
  import BaseSignaling, { AddParticipantParams } from '../abstract/BaseSignaling';
5
- import CallDirection from '../enums/CallDirection';
6
5
  import CallType from '../enums/CallType';
7
6
  import ConversationFeature from '../enums/ConversationFeature';
8
7
  import ConversationOption from '../enums/ConversationOption';
@@ -12,8 +11,8 @@ import UpdateDisplayLayoutErrorReason from '../enums/UpdateDisplayLayoutErrorRea
12
11
  import UserRole from '../enums/UserRole';
13
12
  import UserType from '../enums/UserType';
14
13
  import { JSONObject } from '../static/Json';
15
- import { AsrInfo, IAsrStartParams } from '../types/Asr';
16
- import { IFeaturesPerRole } from '../types/ConversationFeature';
14
+ import { IAsrStartParams } from '../types/Asr';
15
+ import { ConversationData } from '../types/Conversation';
17
16
  import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
18
17
  import MediaModifiers from '../types/MediaModifiers';
19
18
  import { IVideoDimentions } from '../types/MediaSettings';
@@ -25,61 +24,9 @@ import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
25
24
  import ParticipantPriority from '../types/ParticipantPriority';
26
25
  import { ParticipantStreamDescription } from '../types/ParticipantStreamDescription';
27
26
  import { ScreenCaptureSettings } from '../types/ScreenCaptureSettings';
28
- import SignalingMessage, { RecordInfo } from '../types/SignalingMessage';
27
+ import SignalingMessage from '../types/SignalingMessage';
29
28
  import { WaitingHallResponse } from '../types/WaitingHall';
30
29
  import EventEmitter from './EventEmitter';
31
- import { TransportTopology } from './transport/Transport';
32
- /**
33
- * Данные текущего звонка
34
- */
35
- export type ConversationData = {
36
- /** @hidden */
37
- userId: OkUserId;
38
- /** @hidden */
39
- compositeUserId: ParticipantId;
40
- externalId: ExternalParticipantId;
41
- /**
42
- * Время принятия звонка
43
- */
44
- acceptTime: number | null;
45
- features: ConversationFeature[];
46
- /** @hidden */
47
- featuresPerRole?: IFeaturesPerRole | null;
48
- /**
49
- * ID звонка
50
- */
51
- id: string;
52
- participantsLimit: number;
53
- /** @hidden */
54
- topology: TransportTopology;
55
- /** @hidden */
56
- direction: CallDirection;
57
- concurrent: boolean;
58
- needRate: boolean;
59
- /** @hidden */
60
- recordsInfoByRoom: Map<number | null, RecordInfo | null>;
61
- chatId: string | null;
62
- /** @hidden */
63
- asrInfo: AsrInfo | null;
64
- /**
65
- * Роли пользователя
66
- */
67
- roles: UserRole[];
68
- /**
69
- * Токен комнаты для подключения к звонку по ссылке
70
- */
71
- joinLink?: string;
72
- /** @hidden */
73
- pinnedParticipantId: ParticipantId | null;
74
- mediaModifiers: MediaModifiers;
75
- options: ConversationOption[];
76
- muteStates: Map<number | null, MuteStates>;
77
- unmuteOptions: MediaOption[];
78
- networkRating: number;
79
- waitingHall: boolean;
80
- observer: boolean;
81
- roomId: number | null;
82
- };
83
30
  export type ParticipantUpdateInfo = {
84
31
  participantStreamDescription: ParticipantStreamDescription | null;
85
32
  streamId: string;
@@ -1,5 +1,5 @@
1
1
  export default interface IDecoder {
2
- init(onFrameImage: (image: VideoFrame | ImageBitmap | ImageData) => void): Promise<void>;
2
+ init(onFrameImage: (image: VideoFrame | 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 LibVPxDecoder extends WorkerBase implements IDecoder {
4
- init(onFrameImage: (image: ImageData | ImageBitmap) => void): Promise<void>;
4
+ init(onFrameImage: (image: ImageData) => void): Promise<void>;
5
5
  decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
6
6
  destroy(): void;
7
7
  static isBrowserSupported(): boolean;
@@ -2,7 +2,7 @@ export default abstract class BaseRenderer {
2
2
  protected readonly _onStream: (stream: MediaStream) => void;
3
3
  protected constructor(onStream: (stream: MediaStream) => void);
4
4
  drawFrame(frame: VideoFrame): Promise<void>;
5
- drawImage(image: ImageBitmap | ImageData): void;
5
+ drawImage(image: ImageData): Promise<void>;
6
6
  abstract destroy(): void;
7
7
  static isBrowserSupported(): boolean;
8
8
  }
@@ -1,11 +1,15 @@
1
1
  import { ParticipantId } from '../../types/Participant';
2
+ import { IScreenShareStat } from '../../types/ScreenSharingStat';
2
3
  import { FrameChunk } from './Utils';
4
+ export type IOnStat = (stat: IScreenShareStat) => void;
5
+ export type IOnStream = (stream: MediaStream) => void;
3
6
  export declare abstract class BaseStreamBuilder {
4
7
  protected readonly _participantId: ParticipantId;
5
- protected readonly _onStream: (stream: MediaStream) => void;
8
+ protected readonly _onStream: IOnStream;
9
+ protected readonly _onStat: IOnStat;
6
10
  protected _chunks: FrameChunk[];
7
11
  protected _firstFrameReceived: boolean;
8
- protected constructor(participantId: ParticipantId, onStream: (stream: MediaStream) => void);
12
+ protected constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat);
9
13
  appendChunk(chunk: FrameChunk): void;
10
14
  destroy(): void;
11
15
  protected abstract _processFrame(frame: FrameData): void;
@@ -15,6 +19,8 @@ export declare abstract class BaseStreamBuilder {
15
19
  height: number;
16
20
  };
17
21
  static isBrowserSupported(): boolean;
22
+ private _measureFirstFrame;
23
+ private _measureFreezeDuration;
18
24
  }
19
25
  export interface FrameData {
20
26
  timestamp: number;
@@ -9,8 +9,7 @@ export default class CanvasRenderer extends BaseRenderer {
9
9
  private _createStream;
10
10
  private _removeStream;
11
11
  private _requestCanvasFrame;
12
- drawFrame(frame: VideoFrame): Promise<void>;
13
- drawImage(image: ImageBitmap | ImageData): void;
12
+ drawImage(image: ImageData): Promise<void>;
14
13
  destroy(): void;
15
14
  static isBrowserSupported(): boolean;
16
15
  }
@@ -1,12 +1,14 @@
1
1
  import { ParticipantId } from '../../types/Participant';
2
2
  import { ParticipantIdRegistry } from '../ParticipantIdRegistry';
3
+ import { IOnStat } from './BaseStreamBuilder';
3
4
  export default class ScreenCaptureReceiver {
4
5
  private readonly _datachannel;
5
6
  private _participantIdRegistry;
6
7
  private _streamBuilders;
7
8
  private _onStream;
8
9
  private _onEos;
9
- constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, onStream: (streamId: string, stream: MediaStream) => void, onEos: (streamId: string) => void);
10
+ private _onStat;
11
+ constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, onStream: (streamId: string, stream: MediaStream) => void, onEos: (streamId: string) => void, onStat: IOnStat);
10
12
  private _onDataChannelMessage;
11
13
  close(participantId: ParticipantId): void;
12
14
  destroy(): void;
@@ -1,11 +1,11 @@
1
1
  import { ParticipantId } from '../../types/Participant';
2
- import { BaseStreamBuilder, FrameData } from './BaseStreamBuilder';
2
+ import { BaseStreamBuilder, FrameData, IOnStat, IOnStream } from './BaseStreamBuilder';
3
3
  export default class StreamBuilder extends BaseStreamBuilder {
4
4
  private readonly _renderer;
5
5
  private readonly _decoder;
6
6
  private _decoderReady;
7
7
  private _decoderQueue;
8
- constructor(participantId: ParticipantId, onStream: (stream: MediaStream) => void);
8
+ constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat);
9
9
  protected _processFrame(frame: FrameData): void;
10
10
  private _decodeQueue;
11
11
  destroy(): void;
@@ -1,5 +1,5 @@
1
1
  import { ParticipantId } from '../../types/Participant';
2
- import { BaseStreamBuilder, FrameData } from './BaseStreamBuilder';
2
+ import { BaseStreamBuilder, FrameData, IOnStat, IOnStream } from './BaseStreamBuilder';
3
3
  export default class WebmBuilder extends BaseStreamBuilder {
4
4
  private _mediaBuffer;
5
5
  private _video;
@@ -7,7 +7,7 @@ export default class WebmBuilder extends BaseStreamBuilder {
7
7
  private _earliestTimestamp;
8
8
  private _clusterStartTime;
9
9
  private _lastFrameTimestamp;
10
- constructor(participantId: ParticipantId, onStream: (stream: MediaStream) => void);
10
+ constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat);
11
11
  private static _intToU16BE;
12
12
  private static _genWebmHeader;
13
13
  private static _genSegmentHeader;
@@ -29,6 +29,7 @@ export default class PerfStatReporter extends EventEmitter {
29
29
  private _previousTimestamp;
30
30
  private _previousCallStatReportTimestamp;
31
31
  private _previousCallStatReport;
32
+ private _screenShareStats;
32
33
  private _signaling;
33
34
  private readonly _directTopology;
34
35
  constructor(transport: ServerTransport | DirectTransport, signaling: BaseSignaling, directTopology?: boolean);
@@ -37,4 +38,5 @@ export default class PerfStatReporter extends EventEmitter {
37
38
  private _handleStats;
38
39
  private reportPerfStats;
39
40
  private _reportCallStats;
41
+ private _handleScreenSharingStat;
40
42
  }
@@ -2,7 +2,6 @@ import type { AnimojiSvgData } from '@vkontakte/calls-vmoji';
2
2
  import BaseSignaling from '../../abstract/BaseSignaling';
3
3
  import { ParticipantId } from '../../types/Participant';
4
4
  import ServerSettings from '../../types/ServerSettings';
5
- import SignalingMessage from '../../types/SignalingMessage';
6
5
  import EventEmitter from '../EventEmitter';
7
6
  import { MediaSource } from '../MediaSource';
8
7
  import { TransportState } from './Transport';
@@ -83,8 +82,8 @@ export default class ServerTransport extends EventEmitter {
83
82
  private _detectStaleTracks;
84
83
  private _allocateConsumer;
85
84
  private _acceptProducer;
86
- private handleTracks;
87
- _onSignalingNotification(message: SignalingMessage): Promise<void>;
85
+ private _handleTracks;
86
+ private _onSignalingNotification;
88
87
  private _onAsrTranscription;
89
88
  private _onProducerUpdated;
90
89
  private _onAddTrack;
@@ -40,6 +40,10 @@ export type StatRtp = {
40
40
  silentConcealedSamples?: number;
41
41
  concealmentEvents?: number;
42
42
  totalAudioEnergy?: number;
43
+ totalFreezesDuration?: number;
44
+ totalFreezesDurationDelta?: number;
45
+ freezeCount?: number;
46
+ freezeCountDelta?: number;
43
47
  };
44
48
  export type StatItem = {
45
49
  timestamp: number;
@@ -19,7 +19,8 @@ export declare const enum TransportEvent {
19
19
  NETWORK_STATUS = "NETWORK_STATUS",
20
20
  PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED",
21
21
  ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION",
22
- ANIMOJI_STREAM = "ANIMOJI_STREAM"
22
+ ANIMOJI_STREAM = "ANIMOJI_STREAM",
23
+ SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT"
23
24
  }
24
25
  export declare const enum TransportState {
25
26
  IDLE = "IDLE",
package/enums/Stat.d.ts CHANGED
@@ -34,6 +34,7 @@ declare const enum Stat {
34
34
  SCREENSHARE_FIRST_FRAME = "callScreenshareFirstFrame",
35
35
  SCREENSHARE_FIRST_FRAME_SMALL = "callScreenshareFirstFrameSmall",
36
36
  SCREENSHARE_FIRST_FRAME_MEDIUM = "callScreenshareFirstFrameMedium",
37
- SCREENSHARE_FIRST_FRAME_LARGE = "callScreenshareFirstFrameLarge"
37
+ SCREENSHARE_FIRST_FRAME_LARGE = "callScreenshareFirstFrameLarge",
38
+ SCREENSHARE_FREEZE_DURATION = "callScreenshareFreezeDuration"
38
39
  }
39
40
  export default Stat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.7.2-beta.13",
3
+ "version": "2.7.2-beta.15",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -1,4 +1,4 @@
1
- import { ConversationData } from '../classes/Conversation';
1
+ import { ConversationData } from '../types/Conversation';
2
2
  import HangupReason from '../classes/HangupReason';
3
3
  import { MediaTrackKind } from '../classes/MediaSource';
4
4
  import { StatResult } from '../classes/transport/Statistics';
@@ -1,6 +1,6 @@
1
1
  import type { VideoEffects } from '@vkontakte/calls-video-effects';
2
2
  import type * as Vmoji from '@vkontakte/calls-vmoji';
3
- import { ConversationData } from '../classes/Conversation';
3
+ import { ConversationData } from '../types/Conversation';
4
4
  import HangupReason from '../classes/HangupReason';
5
5
  import { MediaTrackKind } from '../classes/MediaSource';
6
6
  import ChatRoomEventType from '../enums/ChatRoomEventType';
@@ -1,6 +1,17 @@
1
+ import { TransportTopology } from '../classes/transport/Transport';
2
+ import CallDirection from '../enums/CallDirection';
3
+ import ConversationFeature from '../enums/ConversationFeature';
4
+ import ConversationOption from '../enums/ConversationOption';
1
5
  import MediaOption from '../enums/MediaOption';
6
+ import UserRole from '../enums/UserRole';
7
+ import { AsrInfo } from './Asr';
8
+ import { IFeaturesPerRole } from './ConversationFeature';
9
+ import { ExternalParticipantId } from './ExternalId';
10
+ import MediaModifiers from './MediaModifiers';
2
11
  import MediaSettings from './MediaSettings';
3
- import { Participant } from './Participant';
12
+ import MuteStates from './MuteStates';
13
+ import { OkUserId, Participant, ParticipantId } from './Participant';
14
+ import { RecordInfo } from './SignalingMessage';
4
15
  export interface IProcessMuteStateParams {
5
16
  mediaOptions?: MediaOption[];
6
17
  muteAll?: boolean;
@@ -11,3 +22,54 @@ export interface IProcessMuteStateParams {
11
22
  requestedMedia?: MediaOption[];
12
23
  roomId?: number | null;
13
24
  }
25
+ /**
26
+ * Данные текущего звонка
27
+ */
28
+ export type ConversationData = {
29
+ /** @hidden */
30
+ userId: OkUserId;
31
+ /** @hidden */
32
+ compositeUserId: ParticipantId;
33
+ externalId: ExternalParticipantId;
34
+ /**
35
+ * Время принятия звонка
36
+ */
37
+ acceptTime: number | null;
38
+ features: ConversationFeature[];
39
+ /** @hidden */
40
+ featuresPerRole?: IFeaturesPerRole | null;
41
+ /**
42
+ * ID звонка
43
+ */
44
+ id: string;
45
+ participantsLimit: number;
46
+ /** @hidden */
47
+ topology: TransportTopology;
48
+ /** @hidden */
49
+ direction: CallDirection;
50
+ concurrent: boolean;
51
+ needRate: boolean;
52
+ /** @hidden */
53
+ recordsInfoByRoom: Map<number | null, RecordInfo | null>;
54
+ chatId: string | null;
55
+ /** @hidden */
56
+ asrInfo: AsrInfo | null;
57
+ /**
58
+ * Роли пользователя
59
+ */
60
+ roles: UserRole[];
61
+ /**
62
+ * Токен комнаты для подключения к звонку по ссылке
63
+ */
64
+ joinLink?: string;
65
+ /** @hidden */
66
+ pinnedParticipantId: ParticipantId | null;
67
+ mediaModifiers: MediaModifiers;
68
+ options: ConversationOption[];
69
+ muteStates: Map<number | null, MuteStates>;
70
+ unmuteOptions: MediaOption[];
71
+ networkRating: number;
72
+ waitingHall: boolean;
73
+ observer: boolean;
74
+ roomId: number | null;
75
+ };
@@ -0,0 +1,3 @@
1
+ export interface IScreenShareStat {
2
+ freeze_duration?: number;
3
+ }