@vkontakte/calls-sdk 2.8.11-dev.3ca8f2a1.0 → 2.8.11-dev.48925708.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.
@@ -20,7 +20,7 @@ import { IVideoDimentions } from '../types/MediaSettings';
20
20
  import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
21
21
  import MuteStates from '../types/MuteStates';
22
22
  import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../types/Participant';
23
- import { ParticipantLayout } from '../types/ParticipantLayout';
23
+ import { DisplayLayoutRequest, 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';
@@ -32,6 +32,7 @@ export default class Conversation extends EventEmitter {
32
32
  private readonly _api;
33
33
  private readonly _signaling;
34
34
  private readonly _signalingActor;
35
+ private readonly _displayLayoutRequester;
35
36
  private _mediaSource;
36
37
  private _conversation;
37
38
  private _myLastRequestedLayouts;
@@ -49,6 +50,7 @@ export default class Conversation extends EventEmitter {
49
50
  private _lastSignalledActiveSpeakerId;
50
51
  private _isRealTimeAsrRequested;
51
52
  private _serverSettings;
53
+ private _serverTimeOffset;
52
54
  private static _current;
53
55
  private static _activationMutex;
54
56
  private static _delayedHangup;
@@ -69,6 +71,7 @@ export default class Conversation extends EventEmitter {
69
71
  static current(): Conversation | null;
70
72
  static hangupAfterInit(): void;
71
73
  static id(): string | null;
74
+ static getSyncedTime(): number;
72
75
  onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
73
76
  onJoin(joinArgs: {
74
77
  conversationId?: string;
@@ -204,6 +207,7 @@ export default class Conversation extends EventEmitter {
204
207
  requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
205
208
  requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
206
209
  updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
210
+ requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
207
211
  feedback(key: string): Promise<SignalingMessage>;
208
212
  userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
209
213
  sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
@@ -0,0 +1,36 @@
1
+ import BaseApi from '../abstract/BaseApi';
2
+ import { DisplayLayoutRequest, ParticipantLayout } from '../types/ParticipantLayout';
3
+ import { Participant, ParticipantId } from '../types/Participant';
4
+ type DisplayLayoutRequesterParams = {
5
+ api: BaseApi;
6
+ getParticipants: () => Promise<Record<ParticipantId, Participant>>;
7
+ isMe: (participantId: ParticipantId) => boolean;
8
+ updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
9
+ };
10
+ export default class DisplayLayoutRequester {
11
+ private readonly _api;
12
+ private readonly _getParticipants;
13
+ private readonly _isMe;
14
+ private readonly _updateDisplayLayout;
15
+ private _requestedLayouts;
16
+ private _uncertainLayouts;
17
+ private _pendingRequests;
18
+ private _pendingPromises;
19
+ private _lastRequests;
20
+ private _timer;
21
+ private _inFlight;
22
+ private _lastFlushAt;
23
+ private _generation;
24
+ private _forceNextFlush;
25
+ constructor({ api, getParticipants, isMe, updateDisplayLayout }: DisplayLayoutRequesterParams);
26
+ request(requests: DisplayLayoutRequest[]): Promise<void>;
27
+ resend(): void;
28
+ cleanupParticipant(participantId: ParticipantId): void;
29
+ clear(): void;
30
+ private _schedule;
31
+ private _flush;
32
+ private _getRequestLayouts;
33
+ private _getDiff;
34
+ private _isChanged;
35
+ }
36
+ export {};
@@ -10,8 +10,8 @@ export default class Logger extends BaseLogger {
10
10
  static setConversationIdProvider(provider: () => string | null): void;
11
11
  static create(api: BaseApi, externalLogger: BaseLogger | null): void;
12
12
  static log(name: StatLog, value?: string, immediately?: boolean): void;
13
- static logClientStats(params: Record<string, string | number | undefined | null>, immediately?: boolean): void;
14
- static logClientEvent(params: Record<string, string | number | undefined | null>, immediately?: boolean): void;
13
+ static logClientStats(params: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
14
+ static logClientEvent(params: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
15
15
  static destroy(): void;
16
16
  private readonly _externalLogger;
17
17
  private readonly _api;
@@ -22,8 +22,8 @@ export default class Logger extends BaseLogger {
22
22
  private _serverTimeDelta;
23
23
  constructor(api: BaseApi, externalLogger: BaseLogger | null);
24
24
  log(name: StatLog, value?: string, immediately?: boolean): void;
25
- logClientStats(data: Record<string, string | number | undefined | null>, immediately?: boolean): void;
26
- logClientEvent(data: Record<string, string | number | undefined | null>, immediately?: boolean): void;
25
+ logClientStats(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
26
+ logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
27
27
  destroy(): void;
28
28
  private _getConversationId;
29
29
  private _sendBatch;
@@ -3,7 +3,6 @@ import { TransportTopology } from '../transport/Transport';
3
3
  declare enum ECallType {
4
4
  DirectOutgoing = "direct_outgoing",
5
5
  DirectIncoming = "direct_incoming",
6
- DirectJoin = "direct_join",
7
6
  ServerIncoming = "server_incoming",
8
7
  ServerJoinServer = "server_join_server",
9
8
  ServerChangeTopology = "server_change_topology"
@@ -13,12 +12,10 @@ export declare class StatFirstMediaReceived {
13
12
  protected _isCallMarked: boolean;
14
13
  protected _isFinished: boolean;
15
14
  protected _callType: ECallType | null;
16
- private _participantJoinedWhileDirect;
17
15
  markAcceptCall(topology: TransportTopology): void;
18
16
  markAcceptedCall(topology?: TransportTopology): void;
19
17
  markParticipantJoined(topology: TransportTopology): void;
20
18
  markOnJoin(topology: TransportTopology): void;
21
- markTopologyChanged(topology: TransportTopology): void;
22
19
  private mark;
23
20
  measure(): void;
24
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.11-dev.3ca8f2a1.0",
3
+ "version": "2.8.11-dev.48925708.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",
@@ -306,6 +306,12 @@ export type ParamsObject = {
306
306
  * _По умолчанию: `30`_
307
307
  */
308
308
  videoTracksCount: number;
309
+ /**
310
+ * Минимальный интервал отправки diff для requestDisplayLayout в миллисекундах.
311
+ *
312
+ * _По умолчанию: `250`_
313
+ */
314
+ requestDisplayLayoutThrottleMs: number;
309
315
  /** @hidden */
310
316
  movieShare: boolean;
311
317
  /** @hidden */
@@ -963,6 +969,7 @@ export default abstract class Params {
963
969
  static get audioNack(): boolean;
964
970
  static get movieShare(): boolean;
965
971
  static get videoTracksCount(): number;
972
+ static get requestDisplayLayoutThrottleMs(): number;
966
973
  static get breakVideoPayloadTypes(): boolean;
967
974
  static get useCallsToContacts(): boolean;
968
975
  static get useParticipantListChunk(): boolean;
@@ -1010,6 +1017,7 @@ export default abstract class Params {
1010
1017
  screenShareCongestionControl: boolean;
1011
1018
  screenShareCongestionControlThreshold: number;
1012
1019
  videoTracksCount: number;
1020
+ requestDisplayLayoutThrottleMs: number;
1013
1021
  asrDataChannel: boolean;
1014
1022
  videoMaxHeight: number;
1015
1023
  videoMaxWidth: number;
@@ -54,4 +54,37 @@ export type ParticipantLayout = (Layout | StopStream | RequestKeyFrame) & {
54
54
  */
55
55
  streamName?: string;
56
56
  };
57
+ /**
58
+ * Запрос стрима, который клиент хочет получать для отображения.
59
+ */
60
+ export type DisplayLayoutRequest = {
61
+ /**
62
+ * Внешний ID пользователя
63
+ */
64
+ uid: ExternalParticipantId | string;
65
+ /**
66
+ * Тип медиа (видео с камеры, картинка с экрана, лайв или мувик)
67
+ */
68
+ mediaType: MediaType;
69
+ /**
70
+ * Ширина окошка в котором отображается видео, в пикселях
71
+ */
72
+ width: number;
73
+ /**
74
+ * Высота окошка в котором отображается видео, в пикселях
75
+ */
76
+ height: number;
77
+ /**
78
+ * Отображать видео как CSS object-fit: cover. По умолчанию используется contain.
79
+ */
80
+ cover?: boolean;
81
+ /**
82
+ * Приоритет
83
+ */
84
+ priority?: number;
85
+ /**
86
+ * ID лайва или мувика. null для камеры или скрин-шары.
87
+ */
88
+ streamName?: string;
89
+ };
57
90
  export default ParticipantLayout;
@@ -41,10 +41,11 @@ export interface CallStatReport {
41
41
  remote_connection_type?: RTCIceCandidateType;
42
42
  }
43
43
  export interface ICallStatLog extends Pick<CallStatReport, 'call_topology' | 'nack_sent' | 'nack_received' | 'pli_sent' | 'pli_received' | 'fir_sent' | 'fir_received' | 'frames_dropped' | 'stat_time_delta'>, Pick<Partial<CallStatReport>, 'rtt' | 'jitter_video' | 'jitter_audio' | 'interframe_delay_variance' | 'freeze_count' | 'total_freezes_duration' | 'ss_freeze_count' | 'ss_total_freezes_duration' | 'inserted_audio_samples_for_deceleration' | 'removed_audio_samples_for_acceleration' | 'concealed_audio_samples' | 'total_audio_energy' | 'local_address' | 'local_connection_type' | 'network_type' | 'transport' | 'remote_address' | 'remote_connection_type'> {
44
+ is_simulcast?: boolean;
44
45
  concealed_silent_audio_samples?: number;
45
46
  concealment_audio_avg_size?: number;
46
47
  video_loss?: number;
47
48
  audio_loss?: number;
48
49
  cpu_hardware_concurrency?: number;
49
- [k: string]: string | number | undefined;
50
+ [k: string]: string | number | boolean | undefined;
50
51
  }
@@ -366,6 +366,9 @@ declare namespace SignalingMessage {
366
366
  export interface Connection extends Notification {
367
367
  endpoint: string;
368
368
  conversation: Conversation;
369
+ conversationParams: {
370
+ serverTime: number;
371
+ };
369
372
  isConcurrent: boolean;
370
373
  peerId: PeerId;
371
374
  mediaModifiers: MediaModifiers;