@vkontakte/calls-sdk 2.8.11-beta.7 → 2.8.11-beta.9

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.
@@ -43,6 +43,7 @@ export default class Conversation extends EventEmitter {
43
43
  private _participantState;
44
44
  private _participants;
45
45
  private _pendingParticipants;
46
+ private _directTransportIsMaster?;
46
47
  private _transport;
47
48
  private _debugInfo;
48
49
  private readonly _debug;
@@ -113,6 +114,7 @@ export default class Conversation extends EventEmitter {
113
114
  setVolume(volume: number): void;
114
115
  updateStatisticsInterval(): void;
115
116
  private _openTransport;
117
+ private _allocateParticipantTransport;
116
118
  private _close;
117
119
  destroy(): Promise<void>;
118
120
  private _getConversationParams;
@@ -132,6 +134,7 @@ export default class Conversation extends EventEmitter {
132
134
  private _prepareConversation;
133
135
  private _createParticipant;
134
136
  private _getParticipantId;
137
+ private _cacheParticipantExternalIds;
135
138
  private _setConversation;
136
139
  private _updateConversation;
137
140
  private _createMediaSource;
@@ -144,10 +147,16 @@ export default class Conversation extends EventEmitter {
144
147
  private _registerParticipants;
145
148
  /** Установим состояние локальных мьютов */
146
149
  private _registerParticipantLocalMuteState;
147
- private _getStatusByTransportState;
150
+ private _remoteParticipantSessionState;
151
+ private _buildConnectionStatus;
152
+ private _isParticipantSessionStateApplicable;
153
+ private _setTransportStatus;
154
+ private _setSessionState;
155
+ private _emitParticipantTransition;
148
156
  private _registerParticipantInCache;
149
157
  private _getExistedParticipantByIdOrCreate;
150
158
  private _getExternalIdByParticipantId;
159
+ private _getExternalIdsByOkIdsFromCache;
151
160
  private _registerParticipantAndSetMarkersIfChunkEnabled;
152
161
  private _warnParticipantNotInConversation;
153
162
  private _denormalizeMarkers;
@@ -224,8 +233,6 @@ export default class Conversation extends EventEmitter {
224
233
  updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
225
234
  requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
226
235
  feedback(key: string): Promise<SignalingMessage>;
227
- userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
228
- sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
229
236
  private _changeMediaSettings;
230
237
  private _stopStreaming;
231
238
  /**
@@ -327,6 +334,11 @@ export default class Conversation extends EventEmitter {
327
334
  private _onSignalingFailed;
328
335
  private _onAcceptedCall;
329
336
  private _onHungup;
337
+ private _onSessionState;
338
+ private _reconcileParticipantSessionStates;
339
+ private _updateParticipantExternalId;
340
+ private _updateParticipantSessionState;
341
+ private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
330
342
  private _onAddedParticipant;
331
343
  private _onJoinedParticipant;
332
344
  private _onClosedConversation;
@@ -10,20 +10,17 @@ export default class StatsLogger extends BaseLogger {
10
10
  private readonly _conversationIdProvider;
11
11
  private readonly _batchInterval;
12
12
  private _batchedClientStats;
13
- private _batchedClientEvents;
14
13
  private _batchTimeout;
15
14
  private _serverTimeDelta;
16
15
  constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null);
17
16
  log(name: StatLog, value?: string, immediately?: boolean): void;
18
17
  logClientStats(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
19
- logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
20
18
  destroy(): void;
21
19
  private _getConversationId;
22
20
  private _sendBatch;
23
21
  private _startTimeout;
24
22
  private _stopTimeout;
25
23
  private _sendClientStats;
26
- private _sendClientEvents;
27
24
  private _calculateServerTimeDelta;
28
25
  private _now;
29
26
  }
@@ -53,6 +53,8 @@ export default class DirectTransport extends BaseTransport {
53
53
  allowRestart(): void;
54
54
  setRemoteHold(hold: boolean): void;
55
55
  private _recreatePeerConnection;
56
+ private _createPeerConnection;
57
+ private _disposePeerConnection;
56
58
  setAnimojiTransport(receiver: AnimojiReceiver, sender: AnimojiSender): void;
57
59
  close(error?: Error): void;
58
60
  private _setState;
package/default/Api.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import BaseApi, { ClientEvent, ClientStats } from '../abstract/BaseApi';
1
+ import BaseApi, { ClientStats } from '../abstract/BaseApi';
2
2
  import CallType from '../enums/CallType';
3
3
  import HangupType from '../enums/HangupType';
4
4
  import ConversationParams from '../types/ConversationParams';
5
5
  import ConversationResponse from '../types/ConversationResponse';
6
6
  import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
7
7
  import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
8
+ import PushData from '../types/PushData';
8
9
  export default class Api extends BaseApi {
9
10
  private _userId;
10
11
  private _uuid;
@@ -19,7 +20,6 @@ export default class Api extends BaseApi {
19
20
  private _removeCachedAnonymLogin;
20
21
  private _applyAnonymLogin;
21
22
  logClientStats(items: ClientStats[]): void;
22
- logClientEvents(items: ClientEvent[]): void;
23
23
  uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
24
24
  joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
25
25
  createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie, audienceMode, audioOnly, waitForAdmin, closedConversation, }?: {
@@ -45,13 +45,9 @@ export default class Api extends BaseApi {
45
45
  }>;
46
46
  getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
47
47
  joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
48
- /**
49
- * NB: Не сохраняет порядок возвращаемых ID
50
- * @hidden
51
- */
52
- getExternalIdsByOkIds(uids: OkUserId[]): Promise<ExternalParticipantId[]>;
53
48
  getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
54
49
  getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
50
+ getCachedExternalIdByOkId(okId: OkUserId): ExternalParticipantId | null;
55
51
  cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
56
52
  mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
57
53
  unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
@@ -63,6 +59,6 @@ export default class Api extends BaseApi {
63
59
  hangupConversation(conversationId: string, reason?: HangupType): void;
64
60
  removeHistoryRecords(recordIds: number[]): Promise<void>;
65
61
  cleanup(): void;
66
- private _getExternalIdsByOkIds;
67
62
  getServerTime(): Promise<number>;
63
+ getInbounds(): Promise<PushData[]>;
68
64
  }
@@ -174,6 +174,8 @@ export default class Signaling extends BaseSignaling {
174
174
  private _serializeErrorEvent;
175
175
  private _onClose;
176
176
  private _closeSocket;
177
+ private _isRecordCommand;
178
+ private _resolvePendingRecordCommands;
177
179
  private _handleCommandResponse;
178
180
  private _handleCommandsQueue;
179
181
  private _startResponseTimer;
@@ -24,6 +24,7 @@ declare enum SignalingNotification {
24
24
  REALLOC_CON = "realloc-con",
25
25
  AUDIO_ACTIVITY = "audio-activity",
26
26
  SPEAKER_CHANGED = "speaker-changed",
27
+ SESSION_STATE = "session-state",
27
28
  STALLED_ACTIVITY = "stalled-activity",
28
29
  CHAT_MESSAGE = "chat-message",
29
30
  CUSTOM_DATA = "custom-data",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.11-beta.7",
3
+ "version": "2.8.11-beta.9",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -256,13 +256,6 @@ export type ParamsObject = {
256
256
  perfStatReportEnabled: boolean;
257
257
  /** @hidden */
258
258
  callStatReportEnabled: boolean;
259
- /**
260
- * Включает логирование событий продуктовой статистики.
261
- *
262
- * _По умолчанию: `false`_
263
- * @hidden
264
- */
265
- clientEventsLoggingEnabled: boolean;
266
259
  /**
267
260
  * Отдавать приоритет кодеку H264 для исходящего видео
268
261
  *
@@ -494,12 +487,26 @@ export type ParamsObject = {
494
487
  * _По умолчанию: `false`_
495
488
  */
496
489
  webtransportFF: boolean;
490
+ /**
491
+ * Ждать подтверждения от бэкенда для команд startStream/stopStream.
492
+ * При включении: reject без соединения, resolve/reject по ответу бэкенда,
493
+ * а при реконнекте — по стейту записи из Connection-сообщения.
494
+ *
495
+ * _По умолчанию: `false`_
496
+ */
497
+ waitForRecordResponse: boolean;
497
498
  /**
498
499
  * Включить поддержку прозрачного аудио
499
500
  *
500
501
  * _По умолчанию: `false`_
501
502
  */
502
503
  transparentAudio: boolean;
504
+ /**
505
+ * Включить получение обновлений состояния медийной сессии участников
506
+ *
507
+ * _По умолчанию: `false`_
508
+ */
509
+ enableSessionStateUpdates: boolean;
503
510
  /**
504
511
  * Получен локальный стрим с камеры/микрофона
505
512
  */
@@ -977,7 +984,6 @@ export default abstract class Params {
977
984
  static get networkStatisticsInterval(): number;
978
985
  static get perfStatReportEnabled(): boolean;
979
986
  static get callStatReportEnabled(): boolean;
980
- static get clientEventsLoggingEnabled(): boolean;
981
987
  static get enableLogPerfStatReport(): boolean;
982
988
  static get asrDataChannel(): boolean;
983
989
  static get consumerScreenDataChannelPacketSize(): number;
@@ -1020,7 +1026,9 @@ export default abstract class Params {
1020
1026
  static get simulcast(): boolean;
1021
1027
  static get webtransport(): boolean;
1022
1028
  static get webtransportFF(): boolean;
1029
+ static get waitForRecordResponse(): boolean;
1023
1030
  static get transparentAudio(): boolean;
1031
+ static get enableSessionStateUpdates(): boolean;
1024
1032
  static toJSON(): {
1025
1033
  apiKey: string;
1026
1034
  apiEnv: string;
@@ -1055,6 +1063,8 @@ export default abstract class Params {
1055
1063
  simulcast: boolean;
1056
1064
  webtransport: boolean;
1057
1065
  webtransportFF: boolean;
1066
+ waitForRecordResponse: boolean;
1058
1067
  transparentAudio: boolean;
1068
+ enableSessionStateUpdates: boolean;
1059
1069
  };
1060
1070
  }
@@ -0,0 +1,16 @@
1
+ import { ParticipantConnectionStatus, ParticipantSessionState } from '../types/Participant';
2
+ import { ParticipantStatus } from './External';
3
+ import TransportState from '../enums/TransportState';
4
+ type StatusTransition = {
5
+ status: ParticipantStatus;
6
+ shouldNotify: boolean;
7
+ };
8
+ declare namespace ParticipantConnectionStatusUtils {
9
+ function create(status?: Partial<ParticipantConnectionStatus> | null): ParticipantConnectionStatus;
10
+ function fromTransportState(state?: TransportState): ParticipantStatus | null;
11
+ function computeEffective(status: ParticipantConnectionStatus): ParticipantStatus;
12
+ function setSessionState(status: ParticipantConnectionStatus, sessionState?: ParticipantSessionState, sessionStateConnectedBySpeaker?: boolean): StatusTransition;
13
+ function setTransport(status: ParticipantConnectionStatus, transport: ParticipantStatus): StatusTransition;
14
+ function setSessionStateApplicable(status: ParticipantConnectionStatus, applicable: boolean): StatusTransition;
15
+ }
16
+ export default ParticipantConnectionStatusUtils;
@@ -18,7 +18,7 @@ export type ExternalUserId = string;
18
18
  export declare namespace ExternalIdUtils {
19
19
  function fromIds(ids: ExternalUserId[] | ExternalId[]): ExternalId[];
20
20
  function fromId(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalParticipantId;
21
- function fromSignalingParticipant(participant: SignalingMessage.Participant, useDecorative?: boolean): ExternalParticipantId | undefined;
21
+ function fromSignalingParticipant(participant: SignalingMessage.Participant, useDecorative?: boolean, fallbackToNonDecorative?: boolean): ExternalParticipantId | undefined;
22
22
  function fromSignaling(signalingId: SignalingMessage.ExternalId, deviceIdx?: number): ExternalParticipantId;
23
23
  function toSignaling(externalId: ExternalId): string;
24
24
  function toString(externalId: ExternalId): ExternalIdString;
@@ -44,6 +44,16 @@ export interface ParticipantStateMapped {
44
44
  ts: number;
45
45
  };
46
46
  }
47
+ export interface ParticipantSessionState {
48
+ connected: boolean;
49
+ }
50
+ export interface ParticipantConnectionStatus {
51
+ transport: ParticipantStatus;
52
+ sessionState?: ParticipantSessionState;
53
+ sessionStateApplicable: boolean;
54
+ sessionStateConnectedBySpeaker: boolean;
55
+ lastEffective: ParticipantStatus;
56
+ }
47
57
  /**
48
58
  * Состояния участников звонка
49
59
  */
@@ -63,7 +73,6 @@ export interface Participant {
63
73
  externalId: ExternalParticipantId;
64
74
  mediaSettings: MediaSettings;
65
75
  state: ParticipantState;
66
- status: ParticipantStatus;
67
76
  remoteStream?: MediaStream | null;
68
77
  remoteAudioTrack?: MediaStreamTrack | null;
69
78
  secondStream?: MediaStream | null;
@@ -73,6 +82,7 @@ export interface Participant {
73
82
  roles: UserRole[];
74
83
  participantState: ParticipantStateMapped;
75
84
  isOnHold?: boolean;
85
+ connectionStatus: ParticipantConnectionStatus;
76
86
  networkRating: number;
77
87
  lastRequestedLayouts: {
78
88
  [key: StreamDescriptionString]: ParticipantLayout;
@@ -1,8 +1,11 @@
1
+ import IceServer from './IceServer';
1
2
  type PushData = {
2
3
  caller_id: string;
3
4
  caller_client_type?: string;
4
5
  conversation_id: string;
5
6
  endpoint: string;
7
+ wt_endpoint?: string;
8
+ turn_server?: IceServer;
6
9
  is_video: boolean;
7
10
  token: string;
8
11
  sdp_offer?: string;
@@ -19,7 +19,7 @@ import MediaModifiers from './MediaModifiers';
19
19
  import MediaSettings from './MediaSettings';
20
20
  import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
21
21
  import MuteStates from './MuteStates';
22
- import { CompositeUserId, OkUserId, ParticipantId, ParticipantListMarker as ParticipantParticipantListMarker, ParticipantListMarkers, ParticipantListType as ParticipantParticipantListType } from './Participant';
22
+ import { CompositeUserId, OkUserId, ParticipantId, ParticipantListMarker as ParticipantParticipantListMarker, ParticipantListMarkers, ParticipantListType as ParticipantParticipantListType, ParticipantSessionState } from './Participant';
23
23
  import { MediaType, ParticipantStreamDescription } from './ParticipantStreamDescription';
24
24
  import { IRoomId } from './Room';
25
25
  import VideoSettings from './VideoSettings';
@@ -89,6 +89,7 @@ declare namespace SignalingMessage {
89
89
  state: Record<string, string>;
90
90
  stateUpdateTs: Record<string, number>;
91
91
  };
92
+ sessionState?: ParticipantSessionState;
92
93
  roles?: UserRole[];
93
94
  peerId?: PeerId;
94
95
  restricted?: boolean;
@@ -324,6 +325,13 @@ declare namespace SignalingMessage {
324
325
  export interface SpeakerChanged extends Notification {
325
326
  speaker: ParticipantId;
326
327
  }
328
+ export interface SessionState extends Notification {
329
+ connected: boolean;
330
+ participantId: OkUserId;
331
+ participantType: UserType;
332
+ deviceIdx?: number;
333
+ markers?: ParticipantListMarkers;
334
+ }
327
335
  export interface OptionsChanged extends Notification {
328
336
  options: ConversationOption[];
329
337
  }