@vkontakte/calls-sdk 2.8.11-dev.6637565d.0 → 2.8.11-dev.6c644bb1.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.
@@ -127,7 +127,6 @@ export default class Conversation extends EventEmitter {
127
127
  private _prepareConversation;
128
128
  private _createParticipant;
129
129
  private _getParticipantId;
130
- private _cacheParticipantExternalIds;
131
130
  private _setConversation;
132
131
  private _updateConversation;
133
132
  private _createMediaSource;
@@ -140,11 +139,15 @@ export default class Conversation extends EventEmitter {
140
139
  private _registerParticipants;
141
140
  /** Установим состояние локальных мьютов */
142
141
  private _registerParticipantLocalMuteState;
143
- private _getStatusByTransportState;
142
+ private _remoteParticipantSessionState;
143
+ private _buildConnectionStatus;
144
+ private _isParticipantSessionStateApplicable;
145
+ private _setTransportStatus;
146
+ private _setSessionState;
147
+ private _emitParticipantTransition;
144
148
  private _registerParticipantInCache;
145
149
  private _getExistedParticipantByIdOrCreate;
146
150
  private _getExternalIdByParticipantId;
147
- private _getExternalIdsByOkIdsFromCache;
148
151
  private _registerParticipantAndSetMarkersIfChunkEnabled;
149
152
  private _warnParticipantNotInConversation;
150
153
  private _denormalizeMarkers;
@@ -317,6 +320,11 @@ export default class Conversation extends EventEmitter {
317
320
  private _onSignalingFailed;
318
321
  private _onAcceptedCall;
319
322
  private _onHungup;
323
+ private _onSessionState;
324
+ private _reconcileParticipantSessionStates;
325
+ private _updateParticipantExternalId;
326
+ private _updateParticipantSessionState;
327
+ private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
320
328
  private _onAddedParticipant;
321
329
  private _onJoinedParticipant;
322
330
  private _onClosedConversation;
package/default/Api.d.ts CHANGED
@@ -45,9 +45,13 @@ 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[]>;
48
53
  getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
49
54
  getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
50
- getCachedExternalIdByOkId(okId: OkUserId): ExternalParticipantId | null;
51
55
  cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
52
56
  mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
53
57
  unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
@@ -59,5 +63,6 @@ export default class Api extends BaseApi {
59
63
  hangupConversation(conversationId: string, reason?: HangupType): void;
60
64
  removeHistoryRecords(recordIds: number[]): Promise<void>;
61
65
  cleanup(): void;
66
+ private _getExternalIdsByOkIds;
62
67
  getServerTime(): Promise<number>;
63
68
  }
@@ -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-dev.6637565d.0",
3
+ "version": "2.8.11-dev.6c644bb1.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",
@@ -493,6 +493,12 @@ export type ParamsObject = {
493
493
  * _По умолчанию: `false`_
494
494
  */
495
495
  transparentAudio: boolean;
496
+ /**
497
+ * Включить получение обновлений состояния медийной сессии участников
498
+ *
499
+ * _По умолчанию: `false`_
500
+ */
501
+ enableSessionStateUpdates: boolean;
496
502
  /**
497
503
  * Получен локальный стрим с камеры/микрофона
498
504
  */
@@ -1007,6 +1013,7 @@ export default abstract class Params {
1007
1013
  static get webtransport(): boolean;
1008
1014
  static get webtransportFF(): boolean;
1009
1015
  static get transparentAudio(): boolean;
1016
+ static get enableSessionStateUpdates(): boolean;
1010
1017
  static toJSON(): {
1011
1018
  apiKey: string;
1012
1019
  apiEnv: string;
@@ -1042,5 +1049,6 @@ export default abstract class Params {
1042
1049
  webtransport: boolean;
1043
1050
  webtransportFF: boolean;
1044
1051
  transparentAudio: boolean;
1052
+ enableSessionStateUpdates: boolean;
1045
1053
  };
1046
1054
  }
@@ -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;
@@ -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;
@@ -72,6 +81,7 @@ export interface Participant {
72
81
  clientType: string;
73
82
  roles: UserRole[];
74
83
  participantState: ParticipantStateMapped;
84
+ connectionStatus: ParticipantConnectionStatus;
75
85
  networkRating: number;
76
86
  lastRequestedLayouts: {
77
87
  [key: StreamDescriptionString]: ParticipantLayout;
@@ -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;
@@ -323,6 +324,13 @@ declare namespace SignalingMessage {
323
324
  export interface SpeakerChanged extends Notification {
324
325
  speaker: ParticipantId;
325
326
  }
327
+ export interface SessionState extends Notification {
328
+ connected: boolean;
329
+ participantId: OkUserId;
330
+ participantType: UserType;
331
+ deviceIdx?: number;
332
+ markers?: ParticipantListMarkers;
333
+ }
326
334
  export interface OptionsChanged extends Notification {
327
335
  options: ConversationOption[];
328
336
  }