@vkontakte/calls-sdk 2.8.11-beta.7 → 2.8.11-beta.8
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.
- package/CallsSDK.d.ts +2 -9
- package/abstract/BaseApi.d.ts +2 -4
- package/calls-sdk.cjs.js +8 -8
- package/calls-sdk.esm.js +1941 -1799
- package/classes/Conversation.d.ts +13 -3
- package/classes/StatsLogger.d.ts +0 -3
- package/classes/transport/DirectTransport.d.ts +2 -0
- package/default/Api.d.ts +3 -2
- package/enums/SignalingNotification.d.ts +1 -0
- package/package.json +1 -1
- package/static/Params.d.ts +8 -8
- package/static/ParticipantConnectionStatusUtils.d.ts +16 -0
- package/types/Participant.d.ts +11 -1
- package/types/PushData.d.ts +3 -0
- package/types/SignalingMessage.d.ts +9 -1
|
@@ -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;
|
|
@@ -144,7 +146,12 @@ export default class Conversation extends EventEmitter {
|
|
|
144
146
|
private _registerParticipants;
|
|
145
147
|
/** Установим состояние локальных мьютов */
|
|
146
148
|
private _registerParticipantLocalMuteState;
|
|
147
|
-
private
|
|
149
|
+
private _remoteParticipantSessionState;
|
|
150
|
+
private _buildConnectionStatus;
|
|
151
|
+
private _isParticipantSessionStateApplicable;
|
|
152
|
+
private _setTransportStatus;
|
|
153
|
+
private _setSessionState;
|
|
154
|
+
private _emitParticipantTransition;
|
|
148
155
|
private _registerParticipantInCache;
|
|
149
156
|
private _getExistedParticipantByIdOrCreate;
|
|
150
157
|
private _getExternalIdByParticipantId;
|
|
@@ -224,8 +231,6 @@ export default class Conversation extends EventEmitter {
|
|
|
224
231
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
225
232
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
226
233
|
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
234
|
private _changeMediaSettings;
|
|
230
235
|
private _stopStreaming;
|
|
231
236
|
/**
|
|
@@ -327,6 +332,11 @@ export default class Conversation extends EventEmitter {
|
|
|
327
332
|
private _onSignalingFailed;
|
|
328
333
|
private _onAcceptedCall;
|
|
329
334
|
private _onHungup;
|
|
335
|
+
private _onSessionState;
|
|
336
|
+
private _reconcileParticipantSessionStates;
|
|
337
|
+
private _updateParticipantExternalId;
|
|
338
|
+
private _updateParticipantSessionState;
|
|
339
|
+
private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
|
|
330
340
|
private _onAddedParticipant;
|
|
331
341
|
private _onJoinedParticipant;
|
|
332
342
|
private _onClosedConversation;
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -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, {
|
|
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, }?: {
|
|
@@ -65,4 +65,5 @@ export default class Api extends BaseApi {
|
|
|
65
65
|
cleanup(): void;
|
|
66
66
|
private _getExternalIdsByOkIds;
|
|
67
67
|
getServerTime(): Promise<number>;
|
|
68
|
+
getInbounds(): Promise<PushData[]>;
|
|
68
69
|
}
|
|
@@ -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
package/static/Params.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -500,6 +493,12 @@ export type ParamsObject = {
|
|
|
500
493
|
* _По умолчанию: `false`_
|
|
501
494
|
*/
|
|
502
495
|
transparentAudio: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Включить получение обновлений состояния медийной сессии участников
|
|
498
|
+
*
|
|
499
|
+
* _По умолчанию: `false`_
|
|
500
|
+
*/
|
|
501
|
+
enableSessionStateUpdates: boolean;
|
|
503
502
|
/**
|
|
504
503
|
* Получен локальный стрим с камеры/микрофона
|
|
505
504
|
*/
|
|
@@ -977,7 +976,6 @@ export default abstract class Params {
|
|
|
977
976
|
static get networkStatisticsInterval(): number;
|
|
978
977
|
static get perfStatReportEnabled(): boolean;
|
|
979
978
|
static get callStatReportEnabled(): boolean;
|
|
980
|
-
static get clientEventsLoggingEnabled(): boolean;
|
|
981
979
|
static get enableLogPerfStatReport(): boolean;
|
|
982
980
|
static get asrDataChannel(): boolean;
|
|
983
981
|
static get consumerScreenDataChannelPacketSize(): number;
|
|
@@ -1021,6 +1019,7 @@ export default abstract class Params {
|
|
|
1021
1019
|
static get webtransport(): boolean;
|
|
1022
1020
|
static get webtransportFF(): boolean;
|
|
1023
1021
|
static get transparentAudio(): boolean;
|
|
1022
|
+
static get enableSessionStateUpdates(): boolean;
|
|
1024
1023
|
static toJSON(): {
|
|
1025
1024
|
apiKey: string;
|
|
1026
1025
|
apiEnv: string;
|
|
@@ -1056,5 +1055,6 @@ export default abstract class Params {
|
|
|
1056
1055
|
webtransport: boolean;
|
|
1057
1056
|
webtransportFF: boolean;
|
|
1058
1057
|
transparentAudio: boolean;
|
|
1058
|
+
enableSessionStateUpdates: boolean;
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
@@ -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;
|
package/types/Participant.d.ts
CHANGED
|
@@ -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;
|
package/types/PushData.d.ts
CHANGED
|
@@ -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
|
}
|