@vkontakte/calls-sdk 2.6.2-dev.4163bb9.0 → 2.6.2-dev.459e12e.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.
- package/CallsSDK.d.ts +79 -16
- package/abstract/BaseApi.d.ts +7 -3
- package/abstract/BaseSignaling.d.ts +17 -5
- package/calls-sdk.cjs.js +8 -8
- package/calls-sdk.esm.js +8 -8
- package/classes/Conversation.d.ts +52 -10
- package/classes/MediaSource.d.ts +7 -2
- package/classes/ProducerCommandSerializationService.d.ts +3 -1
- package/classes/codec/IEncoder.d.ts +3 -0
- package/classes/codec/LibVPxEncoder.d.ts +4 -1
- package/classes/codec/Types.d.ts +6 -1
- package/classes/codec/WebCodecsEncoder.d.ts +4 -1
- package/classes/screenshare/PacketHistory.d.ts +30 -0
- package/classes/screenshare/PacketHistory.test.d.ts +1 -0
- package/classes/screenshare/ScreenCaptureSender.d.ts +15 -1
- package/classes/screenshare/ScreenCongestionControl.d.ts +25 -0
- package/classes/screenshare/SharingStatReport.d.ts +6 -0
- package/classes/screenshare/Utils.d.ts +5 -0
- package/classes/transport/ServerTransport.d.ts +2 -1
- package/default/Api.d.ts +8 -3
- package/default/Api.test.d.ts +1 -0
- package/default/Signaling.d.ts +17 -5
- package/enums/ConversationFeature.d.ts +2 -1
- package/enums/ConversationOption.d.ts +3 -1
- package/enums/HangupType.d.ts +3 -1
- package/enums/LiveStatus.d.ts +7 -0
- package/enums/MediaOption.d.ts +3 -1
- package/enums/RoomsEventType.d.ts +6 -0
- package/enums/SignalingCommandType.d.ts +12 -1
- package/enums/SignalingNotification.d.ts +12 -1
- package/package.json +1 -1
- package/static/External.d.ts +111 -8
- package/static/Params.d.ts +117 -11
- package/static/Polyfills.d.ts +7 -0
- package/static/Utils.d.ts +4 -1
- package/static/WebRTCUtils.d.ts +44 -11
- package/static/WebRTCUtils.test.d.ts +1 -0
- package/types/Asr.d.ts +5 -0
- package/types/Conversation.d.ts +13 -0
- package/types/ConversationFeature.d.ts +3 -0
- package/types/ConversationParams.d.ts +1 -0
- package/types/ExternalId.d.ts +2 -0
- package/types/Feedback.d.ts +22 -0
- package/types/MediaSettings.d.ts +5 -1
- package/types/MovieShare.d.ts +58 -0
- package/types/Participant.d.ts +3 -0
- package/types/ParticipantListChunk.d.ts +2 -0
- package/types/ParticipantStreamDescription.d.ts +2 -1
- package/types/Room.d.ts +77 -0
- package/types/SignalingMessage.d.ts +67 -0
- package/types/WaitingHall.d.ts +2 -8
- package/utils/ArrayDequeue.d.ts +24 -0
- package/utils/ArrayDequeue.spec.d.ts +1 -0
- package/utils/Conversation.d.ts +2 -0
- package/worker/LibVPxEncoderWorker.d.ts +1 -1
|
@@ -12,9 +12,12 @@ import UpdateDisplayLayoutErrorReason from '../enums/UpdateDisplayLayoutErrorRea
|
|
|
12
12
|
import UserRole from '../enums/UserRole';
|
|
13
13
|
import UserType from '../enums/UserType';
|
|
14
14
|
import { JSONObject } from '../static/Json';
|
|
15
|
+
import { IFeaturesPerRole } from '../types/ConversationFeature';
|
|
16
|
+
import { AsrInfo } from '../types/Asr';
|
|
15
17
|
import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
|
|
16
18
|
import MediaModifiers from '../types/MediaModifiers';
|
|
17
19
|
import { IVideoDimentions } from '../types/MediaSettings';
|
|
20
|
+
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
18
21
|
import MuteStates from '../types/MuteStates';
|
|
19
22
|
import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId } from '../types/Participant';
|
|
20
23
|
import { ParticipantLayout } from '../types/ParticipantLayout';
|
|
@@ -37,6 +40,7 @@ export declare type ConversationData = {
|
|
|
37
40
|
*/
|
|
38
41
|
acceptTime: number | null;
|
|
39
42
|
features: ConversationFeature[];
|
|
43
|
+
featuresPerRole?: IFeaturesPerRole | null;
|
|
40
44
|
/**
|
|
41
45
|
* ID звонка
|
|
42
46
|
*/
|
|
@@ -46,8 +50,9 @@ export declare type ConversationData = {
|
|
|
46
50
|
direction: CallDirection;
|
|
47
51
|
concurrent: boolean;
|
|
48
52
|
needRate: boolean;
|
|
49
|
-
|
|
53
|
+
recordsInfo: Record<number | null, RecordInfo | null>;
|
|
50
54
|
chatId: string | null;
|
|
55
|
+
asrInfo: AsrInfo | null;
|
|
51
56
|
/**
|
|
52
57
|
* Роли пользователя
|
|
53
58
|
*/
|
|
@@ -76,6 +81,7 @@ export default class Conversation extends EventEmitter {
|
|
|
76
81
|
private readonly _signaling;
|
|
77
82
|
private _mediaSource;
|
|
78
83
|
private _conversation;
|
|
84
|
+
private _myLastRequestedLayouts;
|
|
79
85
|
private _state;
|
|
80
86
|
private _participantState;
|
|
81
87
|
private _participants;
|
|
@@ -106,13 +112,14 @@ export default class Conversation extends EventEmitter {
|
|
|
106
112
|
static current(): Conversation | null;
|
|
107
113
|
static hangupAfterInit(): void;
|
|
108
114
|
static id(): string | null;
|
|
109
|
-
onStart(opponentIds: OkUserId[], opponentType: CallType, mediaOptions: MediaOption[], payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean): Promise<ConversationData>;
|
|
115
|
+
onStart(opponentIds: OkUserId[], opponentType: CallType, mediaOptions: MediaOption[], payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean, onlyAdminCanShareMovie?: boolean): Promise<ConversationData>;
|
|
110
116
|
onJoin(joinArgs: {
|
|
111
117
|
conversationId?: string;
|
|
112
118
|
mediaOptions: MediaOption[];
|
|
113
119
|
chatId?: string;
|
|
114
120
|
joinLink?: string;
|
|
115
121
|
observedIds?: ExternalUserId[];
|
|
122
|
+
payload?: string;
|
|
116
123
|
}): Promise<ConversationData>;
|
|
117
124
|
private _onJoinPart2;
|
|
118
125
|
onPush(conversationId: string, type?: UserType, peerId?: number): Promise<void>;
|
|
@@ -151,10 +158,12 @@ export default class Conversation extends EventEmitter {
|
|
|
151
158
|
private _processConnection;
|
|
152
159
|
private _prepareParticipants;
|
|
153
160
|
private _onConversationParticipantListChunk;
|
|
161
|
+
private _createParticipantListChunk;
|
|
154
162
|
private _participantListChunkToExternalChunk;
|
|
155
163
|
private _registerConnectionParticipants;
|
|
156
164
|
private _registerParticipants;
|
|
157
|
-
|
|
165
|
+
/** Установим состояние локальных мьютов */
|
|
166
|
+
private _registerParticipantLocalMuteState;
|
|
158
167
|
private _getStatusByTransportState;
|
|
159
168
|
private _registerParticipantInCache;
|
|
160
169
|
private _getExistedParticipantByIdOrCreate;
|
|
@@ -171,6 +180,13 @@ export default class Conversation extends EventEmitter {
|
|
|
171
180
|
* @hidden
|
|
172
181
|
*/
|
|
173
182
|
private _processConnectionData;
|
|
183
|
+
/**
|
|
184
|
+
* Обрабатывает информацию о записи/трансляции в основном и сессионных залах
|
|
185
|
+
* @param connection
|
|
186
|
+
* @private
|
|
187
|
+
* @hidden
|
|
188
|
+
*/
|
|
189
|
+
private _processRecordInfos;
|
|
174
190
|
private _allocateTransport;
|
|
175
191
|
private _createSpeakerDetector;
|
|
176
192
|
private _createSpecListener;
|
|
@@ -188,7 +204,7 @@ export default class Conversation extends EventEmitter {
|
|
|
188
204
|
private _onAddParticipant;
|
|
189
205
|
private _onRemoveParticipant;
|
|
190
206
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
191
|
-
toggleScreenCapturing(
|
|
207
|
+
toggleScreenCapturing(screenEnabled: boolean, audioShareEnabled: boolean): Promise<void>;
|
|
192
208
|
setVideoStream(stream: MediaStream, isScreen?: boolean): Promise<void>;
|
|
193
209
|
setAudioStream(stream: MediaStream): Promise<void>;
|
|
194
210
|
toggleLocalVideo(enabled: boolean): Promise<void>;
|
|
@@ -200,19 +216,31 @@ export default class Conversation extends EventEmitter {
|
|
|
200
216
|
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
|
|
201
217
|
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
|
|
202
218
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
219
|
+
/** @async */
|
|
220
|
+
feedback(key: string): Promise<SignalingMessage>;
|
|
203
221
|
private _stopStreaming;
|
|
204
222
|
private _sendUpdateDisplayLayout;
|
|
205
223
|
private _cleanupCooldownQueue;
|
|
206
224
|
private _onParticipantSourcesUpdate;
|
|
207
225
|
private _onParticipantPromoted;
|
|
208
226
|
private _onChatRoomUpdated;
|
|
227
|
+
private _onSharedMovieUpdate;
|
|
228
|
+
private _onSharedMovieInfoStarted;
|
|
229
|
+
private _processSharedMovieInfos;
|
|
230
|
+
private _processSharedMovieInfo;
|
|
231
|
+
private _processConnectionSharedMovieInfo;
|
|
232
|
+
private _onSharedMovieInfoStopped;
|
|
233
|
+
private _onFeaturesPerRoleChanged;
|
|
209
234
|
private _waitForStreamIfNeeded;
|
|
210
235
|
private _matchStreamDescription;
|
|
211
236
|
private _getWaitingTime;
|
|
212
237
|
private _isCallAdmin;
|
|
213
238
|
private _checkAdminRole;
|
|
214
239
|
grantRoles(participantId: CompositeUserId, roles: UserRole[], revoke: boolean): Promise<void>;
|
|
215
|
-
|
|
240
|
+
startAsr(): Promise<void>;
|
|
241
|
+
stopAsr(): Promise<void>;
|
|
242
|
+
muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia: MediaOption[], roomId: number | null): Promise<void>;
|
|
243
|
+
enableFeatureForRoles(feature: ConversationFeature, roles: UserRole[]): Promise<void>;
|
|
216
244
|
pinParticipant(participantId: ParticipantId, unpin: boolean): Promise<void>;
|
|
217
245
|
updateMediaModifiers(mediaModifiers: MediaModifiers): Promise<void>;
|
|
218
246
|
changeOptions(changes: {
|
|
@@ -229,15 +257,19 @@ export default class Conversation extends EventEmitter {
|
|
|
229
257
|
customData(data: JSONObject, participantId?: ParticipantId | null): Promise<void>;
|
|
230
258
|
createJoinLink(): Promise<string>;
|
|
231
259
|
removeJoinLink(): Promise<never>;
|
|
232
|
-
addMovie(movieId:
|
|
260
|
+
addMovie({ movieId, gain, metadata }: IAddMovieParams): Promise<{
|
|
233
261
|
movieId: string;
|
|
234
262
|
streamType: string;
|
|
235
263
|
}>;
|
|
236
|
-
updateMovie(
|
|
264
|
+
updateMovie(params: IUpdateMovieData): Promise<void>;
|
|
237
265
|
removeMovie(movieId: string): Promise<void>;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
266
|
+
updateRooms(rooms: SignalingMessage.Room[], assignRandomly: boolean): Promise<void>;
|
|
267
|
+
activateRooms(roomIds: number[], deactivate: boolean): Promise<void>;
|
|
268
|
+
switchRoom(toRoomId: number | null, participantId?: ParticipantId): Promise<void>;
|
|
269
|
+
removeRooms(roomIds: number[]): Promise<void>;
|
|
270
|
+
startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null, roomId?: number | null): Promise<SignalingMessage>;
|
|
271
|
+
stopStream(roomId?: number | null): Promise<SignalingMessage>;
|
|
272
|
+
recordSetRole(participantId: ParticipantId, role: RecordRole | null, roomId?: number | null): Promise<void>;
|
|
241
273
|
getStreamInfo(): Promise<{
|
|
242
274
|
movieId: any;
|
|
243
275
|
preview: any;
|
|
@@ -275,11 +307,14 @@ export default class Conversation extends EventEmitter {
|
|
|
275
307
|
private _onChatMessage;
|
|
276
308
|
private _onCustomData;
|
|
277
309
|
private _onRecordInfo;
|
|
310
|
+
changeRecordInfoForRoom(roomId: number | null): Promise<void>;
|
|
311
|
+
private _onAsrInfo;
|
|
278
312
|
private _onRolesChanged;
|
|
279
313
|
/**
|
|
280
314
|
* Клиент должен немедленно выключить микрофон и/или камеру
|
|
281
315
|
*/
|
|
282
316
|
private _onMuteParticipant;
|
|
317
|
+
applyMuteStates(muteStates: MuteStates, mediaOptions: MediaOption[], roomId: number | null): void;
|
|
283
318
|
private _processMuteState;
|
|
284
319
|
private _onPinParticipant;
|
|
285
320
|
private _onOptionsChanged;
|
|
@@ -305,6 +340,13 @@ export default class Conversation extends EventEmitter {
|
|
|
305
340
|
private _updateDisplayLayoutFromCache;
|
|
306
341
|
private _setParticipantsStatus;
|
|
307
342
|
private _onJoinLinkChanged;
|
|
343
|
+
private _onRoomsUpdated;
|
|
344
|
+
private _onRoomUpdated;
|
|
345
|
+
private _convertRoomToExternal;
|
|
346
|
+
private _onRoomParticipantsUpdated;
|
|
347
|
+
/** получили из сингналинга сообщение о реакции пользователей */
|
|
348
|
+
private _onFeedback;
|
|
349
|
+
private _isMe;
|
|
308
350
|
}
|
|
309
351
|
export declare class UpdateDisplayLayoutError extends Error {
|
|
310
352
|
readonly participantErrors: {
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export declare const enum MediaSourceEvent {
|
|
|
13
13
|
export declare const enum MediaTrackKind {
|
|
14
14
|
'audio' = "audio",
|
|
15
15
|
'video' = "video",
|
|
16
|
-
'screen' = "screen"
|
|
16
|
+
'screen' = "screen",
|
|
17
|
+
'audioshare' = "audioshare"
|
|
17
18
|
}
|
|
18
19
|
export declare class MediaSource extends EventEmitter {
|
|
19
20
|
/** Стрим с камеры и микрофона пользователя */
|
|
@@ -21,6 +22,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
21
22
|
/** Последний сохраненный оригинальный видео трек с камеры */
|
|
22
23
|
private _trackVideoStreamBackup;
|
|
23
24
|
private _screenTrack;
|
|
25
|
+
private _audioShareTrack;
|
|
24
26
|
/** Трек для отправки в медиа-канал. Может отличаться при скриншаринге в дата-канал */
|
|
25
27
|
private _sendVideoTrack;
|
|
26
28
|
private _mediaSettings;
|
|
@@ -58,16 +60,19 @@ export declare class MediaSource extends EventEmitter {
|
|
|
58
60
|
private _changeAudioInput;
|
|
59
61
|
private _changeScreen;
|
|
60
62
|
private _disableScreenCapture;
|
|
63
|
+
private disableAudioShare;
|
|
64
|
+
private getSilentAudioShareTrack;
|
|
61
65
|
private _replaceLocalTrack;
|
|
62
66
|
private _stopLocalTrack;
|
|
63
67
|
private _videoEffect;
|
|
64
68
|
/** останавливает и удаляет сохраненный трек с камеры пользователя */
|
|
65
69
|
private _stopAndRemoveTrackVideoStreamBackup;
|
|
66
70
|
destroy(): void;
|
|
67
|
-
toggleScreenCapturing(
|
|
71
|
+
toggleScreenCapturing(captureScreen: boolean, captureAudio: boolean): Promise<void>;
|
|
68
72
|
toggleVideo(enabled: boolean): Promise<void>;
|
|
69
73
|
toggleAudio(enabled: boolean): Promise<void>;
|
|
70
74
|
setResolution(width: number, height: number): Promise<void>;
|
|
71
75
|
updateNoiseSuppression(): Promise<void>;
|
|
72
76
|
videoEffect(effect: IEffect | null): Promise<void>;
|
|
77
|
+
getAudioShareTrack(): MediaStreamTrack | null;
|
|
73
78
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
|
|
2
2
|
import SignalingMessage from '../types/SignalingMessage';
|
|
3
|
+
import { SharingStatReport } from './screenshare/SharingStatReport';
|
|
3
4
|
import { ParticipantIdRegistry } from './ParticipantIdRegistry';
|
|
4
5
|
import { PerfStatReport } from './transport/PerfStatReporter';
|
|
5
6
|
export declare class ProducerCommandSerializationService {
|
|
@@ -11,7 +12,8 @@ export declare class ProducerCommandSerializationService {
|
|
|
11
12
|
private writeLayout;
|
|
12
13
|
private writeStreamDesc;
|
|
13
14
|
serializePerfStatReport(sequenceNumber: number, report: PerfStatReport): ArrayBuffer;
|
|
14
|
-
|
|
15
|
+
serializeSharingStatReport(sequenceNumber: number, report: SharingStatReport): ArrayBuffer;
|
|
16
|
+
deserializeCommandResponse(data: BufferSource | Blob): Promise<SignalingMessage | undefined>;
|
|
15
17
|
private deserializeUpdateDisplayLayoutResponse;
|
|
16
18
|
private deserializeReportPerfStatResponse;
|
|
17
19
|
}
|
|
@@ -4,6 +4,7 @@ export default interface IEncoder {
|
|
|
4
4
|
requestFrame(keyFrame: boolean): void;
|
|
5
5
|
isVP9(): boolean;
|
|
6
6
|
destroy(): void;
|
|
7
|
+
setBitrate(bitrate: number, useCbr: boolean): void;
|
|
7
8
|
}
|
|
8
9
|
export interface FrameMessage {
|
|
9
10
|
type: MessageType;
|
|
@@ -12,4 +13,6 @@ export interface FrameMessage {
|
|
|
12
13
|
duration?: number;
|
|
13
14
|
data?: ArrayBuffer;
|
|
14
15
|
error?: string;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
15
18
|
}
|
|
@@ -4,6 +4,8 @@ import WorkerBase from './WorkerBase';
|
|
|
4
4
|
export default class LibVPxEncoder extends WorkerBase implements IEncoder {
|
|
5
5
|
private readonly _sourceTrack;
|
|
6
6
|
private readonly _onFrame;
|
|
7
|
+
private readonly _useCongestionControl;
|
|
8
|
+
private readonly _maxBitrate;
|
|
7
9
|
private readonly _useImageCapture;
|
|
8
10
|
private _video;
|
|
9
11
|
private _imageCapture;
|
|
@@ -13,7 +15,7 @@ export default class LibVPxEncoder extends WorkerBase implements IEncoder {
|
|
|
13
15
|
private _track;
|
|
14
16
|
private _frameReadTimeout;
|
|
15
17
|
private _lastFrame;
|
|
16
|
-
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback);
|
|
18
|
+
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number);
|
|
17
19
|
private _createDom;
|
|
18
20
|
private _removeDom;
|
|
19
21
|
private _createStream;
|
|
@@ -27,6 +29,7 @@ export default class LibVPxEncoder extends WorkerBase implements IEncoder {
|
|
|
27
29
|
private _requestFrameVideo;
|
|
28
30
|
private _requestFrameBitmap;
|
|
29
31
|
requestFrame(keyFrame?: boolean): void;
|
|
32
|
+
setBitrate(bitrate: number, useCbr?: boolean): void;
|
|
30
33
|
isVP9(): boolean;
|
|
31
34
|
destroy(): void;
|
|
32
35
|
static isBrowserSupported(): boolean;
|
package/classes/codec/Types.d.ts
CHANGED
|
@@ -6,9 +6,14 @@ export declare const enum MessageType {
|
|
|
6
6
|
INIT = "init",
|
|
7
7
|
READY = "ready",
|
|
8
8
|
FRAME = "frame",
|
|
9
|
+
SET_BITRATE = "set_bitrate",
|
|
9
10
|
ERROR = "error",
|
|
10
11
|
DEBUG = "debug",
|
|
11
12
|
LOG_ERROR = "log_error"
|
|
12
13
|
}
|
|
13
|
-
export declare type EncodedVideoFrame = Pick<EncodedVideoChunk, 'type' | 'timestamp' | 'duration' | 'byteLength' | 'data'
|
|
14
|
+
export declare type EncodedVideoFrame = Pick<EncodedVideoChunk, 'type' | 'timestamp' | 'duration' | 'byteLength' | 'data'> & {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
14
18
|
export declare type OnFrameCallback = (chunk: EncodedVideoFrame | null, error?: string) => void;
|
|
19
|
+
export declare type OnCongestionCallback = (bitrate: number, useCbr: boolean) => void;
|
|
@@ -5,9 +5,12 @@ export default class WebCodecsEncoder extends WorkerBase implements IEncoder {
|
|
|
5
5
|
private readonly _sourceTrack;
|
|
6
6
|
private readonly _trackProcessor;
|
|
7
7
|
private readonly _onFrame;
|
|
8
|
-
|
|
8
|
+
private readonly _useCongestionControl;
|
|
9
|
+
private readonly _maxBitrate;
|
|
10
|
+
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number);
|
|
9
11
|
init(): Promise<void>;
|
|
10
12
|
requestFrame(keyFrame?: boolean): void;
|
|
13
|
+
setBitrate(bitrate: number, useCbr: boolean): void;
|
|
11
14
|
isVP9(): boolean;
|
|
12
15
|
destroy(): void;
|
|
13
16
|
static isBrowserSupported(): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare type HistoryRecord = {
|
|
2
|
+
seq: number;
|
|
3
|
+
ts: number;
|
|
4
|
+
size: number;
|
|
5
|
+
sent: number;
|
|
6
|
+
start: boolean;
|
|
7
|
+
end: boolean;
|
|
8
|
+
ts2: number;
|
|
9
|
+
recv: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Class calculates server bitrate and delay, based on server cc feedback
|
|
13
|
+
* Ring buffer to keep sent packets info (HistoryRecord)
|
|
14
|
+
* Packet info is updated when cc feedback is received from server
|
|
15
|
+
*/
|
|
16
|
+
export default class PacketHistory {
|
|
17
|
+
private readonly _maxSize;
|
|
18
|
+
private _size;
|
|
19
|
+
private readonly _buffer;
|
|
20
|
+
private _head;
|
|
21
|
+
private _tail;
|
|
22
|
+
constructor(maxSize: number);
|
|
23
|
+
add(seq: number, ts: number, size: number, start: boolean, end: boolean): number;
|
|
24
|
+
update(seq: number, ts2: number): HistoryRecord;
|
|
25
|
+
get(seq: number): HistoryRecord;
|
|
26
|
+
getServerBitrateK(windowMs: number): number;
|
|
27
|
+
getCurrentDelay(): number;
|
|
28
|
+
getMaxBandwidth(): number;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import BaseSignaling from '../../abstract/BaseSignaling';
|
|
1
2
|
export default class ScreenCaptureSender {
|
|
2
3
|
private readonly _encoder;
|
|
3
4
|
private readonly _datachannel;
|
|
5
|
+
private readonly _signaling;
|
|
4
6
|
private _destroyed;
|
|
5
7
|
private _needKeyframe;
|
|
6
8
|
private readonly DATA_SIZE;
|
|
7
|
-
|
|
9
|
+
private _congestionControl;
|
|
10
|
+
private _frameNum;
|
|
11
|
+
private _width;
|
|
12
|
+
private _height;
|
|
13
|
+
private _feedback;
|
|
14
|
+
private _lastSharingStat;
|
|
15
|
+
private _congestionControlEnabled;
|
|
16
|
+
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: BaseSignaling);
|
|
8
17
|
private _requestFrame;
|
|
9
18
|
private _wrapHeader;
|
|
10
19
|
private _stopPacket;
|
|
@@ -12,4 +21,9 @@ export default class ScreenCaptureSender {
|
|
|
12
21
|
private _sendChunk;
|
|
13
22
|
destroy(): void;
|
|
14
23
|
static isBrowserSupported(): boolean;
|
|
24
|
+
private _onCongestionCallback;
|
|
25
|
+
private _onResize;
|
|
26
|
+
private _calcMinMaxBitrate;
|
|
27
|
+
private _checkCcFeedback;
|
|
28
|
+
private _sendSharingStat;
|
|
15
29
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OnCongestionCallback } from '../codec/Types';
|
|
2
|
+
import { SharingStatReport } from './SharingStatReport';
|
|
3
|
+
export default class ScreenCongestionControl {
|
|
4
|
+
private readonly _onCongestion;
|
|
5
|
+
private readonly _ccEnabled;
|
|
6
|
+
private _minBitrate;
|
|
7
|
+
private _maxBitrate;
|
|
8
|
+
private _targetBitrate;
|
|
9
|
+
private _lastDown;
|
|
10
|
+
private _lastUp;
|
|
11
|
+
private _lastProbing;
|
|
12
|
+
private _lastCheckDelay;
|
|
13
|
+
private _upPenalty;
|
|
14
|
+
private _probing;
|
|
15
|
+
private _delayAvgShort;
|
|
16
|
+
private _delayAvgLong;
|
|
17
|
+
private _minDelay;
|
|
18
|
+
private _maxDelay;
|
|
19
|
+
private _largeDelayDuration;
|
|
20
|
+
constructor(onCongestion: OnCongestionCallback, minBitrate: number, maxBitrate: number, ccEnabled: boolean);
|
|
21
|
+
checkDelay(frameNum: number, delay: number, bitrateK: number): void;
|
|
22
|
+
private _calcDelay;
|
|
23
|
+
reconfigure(minBitrate: number, maxBitrate: number): void;
|
|
24
|
+
getStat(): SharingStatReport;
|
|
25
|
+
}
|
|
@@ -15,3 +15,8 @@ export interface FrameChunk extends FrameChunkHeader {
|
|
|
15
15
|
export declare function wrapHeader(timestamp: number, start: boolean, end: boolean, keyframe: boolean, sequence: number, isVP9: boolean, data: ArrayBuffer | null): ArrayBuffer;
|
|
16
16
|
export declare function parseChunk(data: ArrayBuffer): FrameChunk;
|
|
17
17
|
export declare function isKeyframeRequested(data?: ArrayBuffer): boolean;
|
|
18
|
+
export interface CcFeedback {
|
|
19
|
+
seq: number;
|
|
20
|
+
ts2: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseCcFeedback(data?: ArrayBuffer): CcFeedback;
|
|
@@ -33,6 +33,7 @@ export default class ServerTransport extends EventEmitter {
|
|
|
33
33
|
private _disabledSenders;
|
|
34
34
|
private _rtpReceiversByStreamId;
|
|
35
35
|
private _producerSessionId;
|
|
36
|
+
private _newAudioShareTrack;
|
|
36
37
|
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings);
|
|
37
38
|
getState(): TransportState;
|
|
38
39
|
updateStatisticsInterval(): void;
|
|
@@ -68,12 +69,12 @@ export default class ServerTransport extends EventEmitter {
|
|
|
68
69
|
private _detectStaleTracks;
|
|
69
70
|
private _allocateConsumer;
|
|
70
71
|
private _acceptProducer;
|
|
72
|
+
private handleTracks;
|
|
71
73
|
_onSignalingNotification(message: SignalingMessage): Promise<void>;
|
|
72
74
|
private _onProducerUpdated;
|
|
73
75
|
private _onAddTrack;
|
|
74
76
|
static _onSignalingStateChange(pc: RTCPeerConnection, event: any): void;
|
|
75
77
|
private _onConnectionStateChange;
|
|
76
78
|
private _onReplacedTrack;
|
|
77
|
-
private static _isUnifiedPlanSupported;
|
|
78
79
|
getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
|
|
79
80
|
}
|
package/default/Api.d.ts
CHANGED
|
@@ -16,8 +16,13 @@ export default class Api extends BaseApi {
|
|
|
16
16
|
log(items: LogItem[]): void;
|
|
17
17
|
init(): void;
|
|
18
18
|
joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
|
|
19
|
-
createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean
|
|
20
|
-
|
|
19
|
+
createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie }?: {
|
|
20
|
+
onlyAdminCanShareMovie?: boolean;
|
|
21
|
+
}): Promise<ConversationResponse>;
|
|
22
|
+
startConversation(conversationId: string, ids?: OkUserId[], type?: CallType, isVideo?: boolean, payload?: string, joiningAllowed?: boolean, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie }?: {
|
|
23
|
+
onlyAdminCanShareMovie?: boolean;
|
|
24
|
+
}): Promise<ConversationResponse>;
|
|
25
|
+
private _preareStartConversationData;
|
|
21
26
|
private _startConversation;
|
|
22
27
|
createJoinLink(conversationId: string): Promise<{
|
|
23
28
|
join_link: string;
|
|
@@ -26,7 +31,7 @@ export default class Api extends BaseApi {
|
|
|
26
31
|
success: boolean;
|
|
27
32
|
}>;
|
|
28
33
|
getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
|
|
29
|
-
joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[]): Promise<ConversationResponse>;
|
|
34
|
+
joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
|
|
30
35
|
/**
|
|
31
36
|
* NB: Не сохраняет порядок возвращаемых ID
|
|
32
37
|
* @hidden
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/default/Signaling.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import BaseSignaling, { AddParticipantParams } from '../abstract/BaseSignaling';
|
|
|
2
2
|
import { ParticipantIdRegistry } from '../classes/ParticipantIdRegistry';
|
|
3
3
|
import { PerfStatReport } from '../classes/transport/PerfStatReporter';
|
|
4
4
|
import { TransportTopology } from '../classes/transport/Transport';
|
|
5
|
+
import ConversationFeature from '../enums/ConversationFeature';
|
|
5
6
|
import ConversationOption from '../enums/ConversationOption';
|
|
6
7
|
import MediaOption from '../enums/MediaOption';
|
|
7
8
|
import RecordRole from '../enums/RecordRole';
|
|
@@ -11,12 +12,14 @@ import UserRole from '../enums/UserRole';
|
|
|
11
12
|
import { JSONObject } from '../static/Json';
|
|
12
13
|
import MediaModifiers from '../types/MediaModifiers';
|
|
13
14
|
import MediaSettings from '../types/MediaSettings';
|
|
15
|
+
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
14
16
|
import MuteStates from '../types/MuteStates';
|
|
15
17
|
import { CompositeUserId, ParticipantId } from '../types/Participant';
|
|
16
18
|
import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
|
|
17
19
|
import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
|
|
18
20
|
import SignalingMessage from '../types/SignalingMessage';
|
|
19
21
|
import { WaitingParticipantId } from '../types/WaitingHall';
|
|
22
|
+
import { SharingStatReport } from '../classes/screenshare/SharingStatReport';
|
|
20
23
|
export default class Signaling extends BaseSignaling {
|
|
21
24
|
private socket;
|
|
22
25
|
protected sequence: number;
|
|
@@ -96,21 +99,27 @@ export default class Signaling extends BaseSignaling {
|
|
|
96
99
|
updateDisplayLayout(layouts: {
|
|
97
100
|
[streamDesc: string]: ParticipantLayout | StopStream | RequestKeyFrame;
|
|
98
101
|
}): Promise<SignalingMessage>;
|
|
99
|
-
addMovie(data:
|
|
100
|
-
updateMovie(data:
|
|
102
|
+
addMovie(data: IAddMovieParams): Promise<SignalingMessage>;
|
|
103
|
+
updateMovie(data: IUpdateMovieData): Promise<SignalingMessage>;
|
|
101
104
|
removeMovie(data: any): Promise<SignalingMessage>;
|
|
105
|
+
updateRooms(rooms: SignalingMessage.Room[], assignRandomly: boolean): Promise<SignalingMessage>;
|
|
106
|
+
activateRooms(roomIds: number[], deactivate: boolean): Promise<SignalingMessage>;
|
|
107
|
+
switchRoom(toRoomId: number | null, participantId?: ParticipantId): Promise<SignalingMessage>;
|
|
108
|
+
removeRooms(roomIds: number[]): Promise<SignalingMessage>;
|
|
102
109
|
startStream(data: any): Promise<SignalingMessage>;
|
|
103
|
-
stopStream(): Promise<SignalingMessage>;
|
|
104
|
-
recordSetRole(participantId: ParticipantId, role: RecordRole | null): Promise<SignalingMessage>;
|
|
110
|
+
stopStream(data: any): Promise<SignalingMessage>;
|
|
111
|
+
recordSetRole(participantId: ParticipantId, role: RecordRole | null, roomId: number | null): Promise<SignalingMessage>;
|
|
105
112
|
getRecordStatus(): Promise<SignalingMessage>;
|
|
106
113
|
switchTopology(topology: TransportTopology, force?: boolean): Promise<SignalingMessage>;
|
|
107
114
|
requestRealloc(): Promise<SignalingMessage>;
|
|
108
115
|
reportPerfStat(report: PerfStatReport): Promise<SignalingMessage>;
|
|
116
|
+
reportSharingStat(report: SharingStatReport): Promise<SignalingMessage>;
|
|
109
117
|
chatMessage(message: string, participantId?: CompositeUserId | null): Promise<SignalingMessage>;
|
|
110
118
|
chatHistory(count: number): Promise<SignalingMessage>;
|
|
111
119
|
customData(data: JSONObject, participantId: ParticipantId | null): Promise<SignalingMessage>;
|
|
112
120
|
grantRoles(participantId: CompositeUserId, roles: UserRole[], revoke: boolean): Promise<SignalingMessage>;
|
|
113
|
-
muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia: MediaOption[]): Promise<SignalingMessage>;
|
|
121
|
+
muteParticipant(participantId: ParticipantId | null, muteStates: MuteStates, requestedMedia: MediaOption[], roomId: number | null): Promise<SignalingMessage>;
|
|
122
|
+
enableFeatureForRoles(feature: ConversationFeature, roles: UserRole[]): Promise<SignalingMessage>;
|
|
114
123
|
pinParticipant(participantId: ParticipantId, unpin: boolean): Promise<SignalingMessage>;
|
|
115
124
|
updateMediaModifiers(mediaModifiers: MediaModifiers): Promise<SignalingMessage>;
|
|
116
125
|
changeOptions(changes: {
|
|
@@ -118,6 +127,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
118
127
|
}): Promise<SignalingMessage>;
|
|
119
128
|
getWaitingHall(fromId?: WaitingParticipantId | null, count?: number, backward?: boolean): Promise<SignalingMessage>;
|
|
120
129
|
promoteParticipant(participantId: CompositeUserId, demote?: boolean): Promise<SignalingMessage>;
|
|
130
|
+
feedback(key: string): Promise<SignalingMessage>;
|
|
121
131
|
/**
|
|
122
132
|
* Close a connection with a signaling server
|
|
123
133
|
*/
|
|
@@ -131,6 +141,8 @@ export default class Signaling extends BaseSignaling {
|
|
|
131
141
|
readyToSend(): void;
|
|
132
142
|
getParticipantListChunk(participantListChunkParameters: ParticipantListChunkParameters): Promise<SignalingMessage>;
|
|
133
143
|
getParticipants(externalIds: SignalingMessage.ExternalId[]): Promise<SignalingMessage>;
|
|
144
|
+
startAsr(): Promise<SignalingMessage>;
|
|
145
|
+
stopAsr(): Promise<SignalingMessage>;
|
|
134
146
|
protected _connect(connectionType: SignalingConnectionType): void;
|
|
135
147
|
protected _disconnect(): void;
|
|
136
148
|
private _onOpen;
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
declare enum ConversationOption {
|
|
5
5
|
REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN",
|
|
6
6
|
AUDIENCE_MODE = "AUDIENCE_MODE",
|
|
7
|
-
WAITING_HALL = "WAITING_HALL"
|
|
7
|
+
WAITING_HALL = "WAITING_HALL",
|
|
8
|
+
ASR = "ASR",
|
|
9
|
+
FEEDBACK = "FEEDBACK"
|
|
8
10
|
}
|
|
9
11
|
export default ConversationOption;
|
|
10
12
|
export declare function compareOptions(oldOptions: ConversationOption[], newOptions: ConversationOption[]): boolean;
|
package/enums/HangupType.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare enum HangupType {
|
|
|
16
16
|
CALLER_IS_BLOCKED = "CALLER_IS_BLOCKED",
|
|
17
17
|
NOT_FRIENDS = "NOT_FRIENDS",
|
|
18
18
|
CALLEE_IS_OFFLINE = "CALLEE_IS_OFFLINE",
|
|
19
|
+
CALLER_IS_REJECTED = "CALLER_IS_REJECTED",
|
|
19
20
|
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
20
21
|
UNSUPPORTED = "UNSUPPORTED",
|
|
21
22
|
OLD_VERSION = "OLD_VERSION",
|
|
@@ -23,6 +24,7 @@ declare enum HangupType {
|
|
|
23
24
|
EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR",
|
|
24
25
|
SOCKET_CLOSED = "SOCKET_CLOSED",
|
|
25
26
|
ENDED = "ENDED",
|
|
26
|
-
KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE"
|
|
27
|
+
KILLED_WITHOUT_DELETE = "KILLED_WITHOUT_DELETE",
|
|
28
|
+
ANOTHER_DEVICE = "ANOTHER_DEVICE"
|
|
27
29
|
}
|
|
28
30
|
export default HangupType;
|
package/enums/MediaOption.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare enum SignalingCommandType {
|
|
|
12
12
|
CHANGE_STREAM_PRIORITIES = "change-streams-priorities",
|
|
13
13
|
UPDATE_DISPLAY_LAYOUT = "update-display-layout",
|
|
14
14
|
REPORT_PERF_STAT = "report-perf-stat",
|
|
15
|
+
REPORT_SHARING_STAT = "report-sharing-stat",
|
|
15
16
|
RECORD_START = "record-start",
|
|
16
17
|
RECORD_STOP = "record-stop",
|
|
17
18
|
RECORD_SET_ROLE = "record-set-role",
|
|
@@ -24,6 +25,7 @@ declare enum SignalingCommandType {
|
|
|
24
25
|
CUSTOM_DATA = "custom-data",
|
|
25
26
|
GRANT_ROLES = "grant-roles",
|
|
26
27
|
MUTE_PARTICIPANT = "mute-participant",
|
|
28
|
+
ENABLE_FEATURE_FOR_ROLES = "enable-feature-for-roles",
|
|
27
29
|
PIN_PARTICIPANT = "pin-participant",
|
|
28
30
|
UPDATE_MEDIA_MODIFIERS = "update-media-modifiers",
|
|
29
31
|
CHANGE_OPTIONS = "change-options",
|
|
@@ -34,6 +36,15 @@ declare enum SignalingCommandType {
|
|
|
34
36
|
REQUEST_TEST_MODE = "request-test-mode",
|
|
35
37
|
ADD_MOVIE = "add-movie",
|
|
36
38
|
UPDATE_MOVIE = "update-movie",
|
|
37
|
-
REMOVE_MOVIE = "remove-movie"
|
|
39
|
+
REMOVE_MOVIE = "remove-movie",
|
|
40
|
+
GET_ROOMS = "get_rooms",
|
|
41
|
+
GET_ROOM = "get_room",
|
|
42
|
+
UPDATE_ROOMS = "update-rooms",
|
|
43
|
+
ACTIVATE_ROOMS = "activate-rooms",
|
|
44
|
+
REMOVE_ROOMS = "remove-rooms",
|
|
45
|
+
SWITCH_ROOM = "switch-room",
|
|
46
|
+
FEEDBACK = "feedback",
|
|
47
|
+
ASR_START = "asr-start",
|
|
48
|
+
ASR_STOP = "asr-stop"
|
|
38
49
|
}
|
|
39
50
|
export default SignalingCommandType;
|