@signalapp/ringrtc 2.23.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/dist/index.d.ts +4 -0
- package/dist/index.js +41 -0
- package/dist/ringrtc/Service.d.ts +520 -0
- package/dist/ringrtc/Service.js +1462 -0
- package/dist/ringrtc/VideoSupport.d.ts +66 -0
- package/dist/ringrtc/VideoSupport.js +421 -0
- package/dist/test/RingRTC-test.d.ts +1 -0
- package/dist/test/RingRTC-test.js +71 -0
- package/package.json +55 -0
- package/scripts/fetch-prebuild.js +86 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AudioDevice, BandwidthMode, Call, CallEndedReason, CallId, CallLogLevel, CallMessageUrgency, CallSettings, CallState, CallingMessage, ConnectionState, DeviceId, GroupCall, GroupCallEndReason, GroupCallObserver, GroupMemberInfo, HangupMessage, HangupType, HttpMethod, JoinState, LocalDeviceState, OfferType, OpaqueMessage, PeekInfo, RemoteDeviceState, RingCancelReason, RingRTCType, RingUpdate, UserId, VideoCapturer, VideoRenderer, VideoRequest, } from './ringrtc/Service';
|
|
2
|
+
export { CanvasVideoRenderer, GumVideoCapturer, VideoFrameSource, MAX_VIDEO_CAPTURE_AREA, MAX_VIDEO_CAPTURE_BUFFER_SIZE, MAX_VIDEO_CAPTURE_HEIGHT, MAX_VIDEO_CAPTURE_WIDTH, } from './ringrtc/VideoSupport';
|
|
3
|
+
import { RingRTCType } from './ringrtc/Service';
|
|
4
|
+
export declare const RingRTC: RingRTCType;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2019-2021 Signal Messenger, LLC
|
|
4
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
//
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RingRTC = exports.MAX_VIDEO_CAPTURE_WIDTH = exports.MAX_VIDEO_CAPTURE_HEIGHT = exports.MAX_VIDEO_CAPTURE_BUFFER_SIZE = exports.MAX_VIDEO_CAPTURE_AREA = exports.GumVideoCapturer = exports.CanvasVideoRenderer = exports.VideoRequest = exports.RingUpdate = exports.RingRTCType = exports.RingCancelReason = exports.RemoteDeviceState = exports.PeekInfo = exports.OpaqueMessage = exports.OfferType = exports.LocalDeviceState = exports.JoinState = exports.HttpMethod = exports.HangupType = exports.HangupMessage = exports.GroupMemberInfo = exports.GroupCallEndReason = exports.GroupCall = exports.ConnectionState = exports.CallingMessage = exports.CallState = exports.CallMessageUrgency = exports.CallLogLevel = exports.CallEndedReason = exports.Call = exports.BandwidthMode = void 0;
|
|
8
|
+
var Service_1 = require("./ringrtc/Service");
|
|
9
|
+
Object.defineProperty(exports, "BandwidthMode", { enumerable: true, get: function () { return Service_1.BandwidthMode; } });
|
|
10
|
+
Object.defineProperty(exports, "Call", { enumerable: true, get: function () { return Service_1.Call; } });
|
|
11
|
+
Object.defineProperty(exports, "CallEndedReason", { enumerable: true, get: function () { return Service_1.CallEndedReason; } });
|
|
12
|
+
Object.defineProperty(exports, "CallLogLevel", { enumerable: true, get: function () { return Service_1.CallLogLevel; } });
|
|
13
|
+
Object.defineProperty(exports, "CallMessageUrgency", { enumerable: true, get: function () { return Service_1.CallMessageUrgency; } });
|
|
14
|
+
Object.defineProperty(exports, "CallState", { enumerable: true, get: function () { return Service_1.CallState; } });
|
|
15
|
+
Object.defineProperty(exports, "CallingMessage", { enumerable: true, get: function () { return Service_1.CallingMessage; } });
|
|
16
|
+
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return Service_1.ConnectionState; } });
|
|
17
|
+
Object.defineProperty(exports, "GroupCall", { enumerable: true, get: function () { return Service_1.GroupCall; } });
|
|
18
|
+
Object.defineProperty(exports, "GroupCallEndReason", { enumerable: true, get: function () { return Service_1.GroupCallEndReason; } });
|
|
19
|
+
Object.defineProperty(exports, "GroupMemberInfo", { enumerable: true, get: function () { return Service_1.GroupMemberInfo; } });
|
|
20
|
+
Object.defineProperty(exports, "HangupMessage", { enumerable: true, get: function () { return Service_1.HangupMessage; } });
|
|
21
|
+
Object.defineProperty(exports, "HangupType", { enumerable: true, get: function () { return Service_1.HangupType; } });
|
|
22
|
+
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return Service_1.HttpMethod; } });
|
|
23
|
+
Object.defineProperty(exports, "JoinState", { enumerable: true, get: function () { return Service_1.JoinState; } });
|
|
24
|
+
Object.defineProperty(exports, "LocalDeviceState", { enumerable: true, get: function () { return Service_1.LocalDeviceState; } });
|
|
25
|
+
Object.defineProperty(exports, "OfferType", { enumerable: true, get: function () { return Service_1.OfferType; } });
|
|
26
|
+
Object.defineProperty(exports, "OpaqueMessage", { enumerable: true, get: function () { return Service_1.OpaqueMessage; } });
|
|
27
|
+
Object.defineProperty(exports, "PeekInfo", { enumerable: true, get: function () { return Service_1.PeekInfo; } });
|
|
28
|
+
Object.defineProperty(exports, "RemoteDeviceState", { enumerable: true, get: function () { return Service_1.RemoteDeviceState; } });
|
|
29
|
+
Object.defineProperty(exports, "RingCancelReason", { enumerable: true, get: function () { return Service_1.RingCancelReason; } });
|
|
30
|
+
Object.defineProperty(exports, "RingRTCType", { enumerable: true, get: function () { return Service_1.RingRTCType; } });
|
|
31
|
+
Object.defineProperty(exports, "RingUpdate", { enumerable: true, get: function () { return Service_1.RingUpdate; } });
|
|
32
|
+
Object.defineProperty(exports, "VideoRequest", { enumerable: true, get: function () { return Service_1.VideoRequest; } });
|
|
33
|
+
var VideoSupport_1 = require("./ringrtc/VideoSupport");
|
|
34
|
+
Object.defineProperty(exports, "CanvasVideoRenderer", { enumerable: true, get: function () { return VideoSupport_1.CanvasVideoRenderer; } });
|
|
35
|
+
Object.defineProperty(exports, "GumVideoCapturer", { enumerable: true, get: function () { return VideoSupport_1.GumVideoCapturer; } });
|
|
36
|
+
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_AREA", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_AREA; } });
|
|
37
|
+
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_BUFFER_SIZE", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_BUFFER_SIZE; } });
|
|
38
|
+
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_HEIGHT", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_HEIGHT; } });
|
|
39
|
+
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_WIDTH", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_WIDTH; } });
|
|
40
|
+
const Service_2 = require("./ringrtc/Service");
|
|
41
|
+
exports.RingRTC = new Service_2.RingRTCType();
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { GumVideoCaptureOptions, VideoPixelFormatEnum } from './VideoSupport';
|
|
3
|
+
declare class Config {
|
|
4
|
+
use_new_audio_device_module: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare type GroupId = Buffer;
|
|
7
|
+
declare type GroupCallUserId = Buffer;
|
|
8
|
+
export declare class PeekDeviceInfo {
|
|
9
|
+
demuxId: number;
|
|
10
|
+
userId?: GroupCallUserId;
|
|
11
|
+
constructor(demuxId: number, userId: GroupCallUserId | undefined);
|
|
12
|
+
}
|
|
13
|
+
export declare class PeekInfo {
|
|
14
|
+
devices: Array<PeekDeviceInfo>;
|
|
15
|
+
creator?: GroupCallUserId;
|
|
16
|
+
eraId?: string;
|
|
17
|
+
maxDevices?: number;
|
|
18
|
+
deviceCount: number;
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
declare enum NetworkAdapterType {
|
|
22
|
+
Unknown = 0,
|
|
23
|
+
Ethernet = 1,
|
|
24
|
+
Wifi = 2,
|
|
25
|
+
Cellular = 4,
|
|
26
|
+
Vpn = 8,
|
|
27
|
+
Loopback = 16,
|
|
28
|
+
Default = 32,
|
|
29
|
+
Cellular2G = 64,
|
|
30
|
+
Cellular3G = 128,
|
|
31
|
+
Cellular4G = 256,
|
|
32
|
+
Cellular5G = 512
|
|
33
|
+
}
|
|
34
|
+
export declare class NetworkRoute {
|
|
35
|
+
localAdapterType: NetworkAdapterType;
|
|
36
|
+
constructor();
|
|
37
|
+
}
|
|
38
|
+
export declare type RawAudioLevel = number;
|
|
39
|
+
export declare type NormalizedAudioLevel = number;
|
|
40
|
+
export declare class ReceivedAudioLevel {
|
|
41
|
+
demuxId: number;
|
|
42
|
+
level: RawAudioLevel;
|
|
43
|
+
constructor(demuxId: number, level: RawAudioLevel);
|
|
44
|
+
}
|
|
45
|
+
export declare class RingRTCType {
|
|
46
|
+
private readonly callManager;
|
|
47
|
+
private _call;
|
|
48
|
+
private _groupCallByClientId;
|
|
49
|
+
private _peekRequests;
|
|
50
|
+
private _callInfoByCallId;
|
|
51
|
+
private getCallInfoKey;
|
|
52
|
+
handleOutgoingSignaling: ((remoteUserId: UserId, message: CallingMessage) => Promise<boolean>) | null;
|
|
53
|
+
handleIncomingCall: ((call: Call) => Promise<CallSettings | null>) | null;
|
|
54
|
+
handleAutoEndedIncomingCallRequest: ((callId: CallId, remoteUserId: UserId, reason: CallEndedReason, ageSec: number, wasVideoCall: boolean, receivedAtCounter: number | undefined) => void) | null;
|
|
55
|
+
handleLogMessage: ((level: CallLogLevel, fileName: string, line: number, message: string) => void) | null;
|
|
56
|
+
handleSendHttpRequest: ((requestId: number, url: string, method: HttpMethod, headers: {
|
|
57
|
+
[name: string]: string;
|
|
58
|
+
}, body: Buffer | undefined) => void) | null;
|
|
59
|
+
handleSendCallMessage: ((recipientUuid: Buffer, message: Buffer, urgency: CallMessageUrgency) => void) | null;
|
|
60
|
+
handleSendCallMessageToGroup: ((groupId: Buffer, message: Buffer, urgency: CallMessageUrgency) => void) | null;
|
|
61
|
+
handleGroupCallRingUpdate: ((groupId: Buffer, ringId: bigint, sender: Buffer, update: RingUpdate) => void) | null;
|
|
62
|
+
constructor();
|
|
63
|
+
setConfig(config: Config): void;
|
|
64
|
+
setSelfUuid(uuid: Buffer): void;
|
|
65
|
+
startOutgoingCall(remoteUserId: UserId, isVideoCall: boolean, localDeviceId: DeviceId, settings: CallSettings): Call;
|
|
66
|
+
cancelGroupRing(groupId: GroupId, ringId: bigint, reason: RingCancelReason | null): void;
|
|
67
|
+
onStartOutgoingCall(remoteUserId: UserId, callId: CallId): void;
|
|
68
|
+
onStartIncomingCall(remoteUserId: UserId, callId: CallId, isVideoCall: boolean): void;
|
|
69
|
+
private proceed;
|
|
70
|
+
onCallState(remoteUserId: UserId, state: CallState): void;
|
|
71
|
+
onCallEnded(remoteUserId: UserId, callId: CallId, reason: CallEndedReason, ageSec: number): void;
|
|
72
|
+
onRemoteVideoEnabled(remoteUserId: UserId, enabled: boolean): void;
|
|
73
|
+
onRemoteSharingScreen(remoteUserId: UserId, enabled: boolean): void;
|
|
74
|
+
onNetworkRouteChanged(remoteUserId: UserId, localNetworkAdapterType: NetworkAdapterType): void;
|
|
75
|
+
onAudioLevels(remoteUserId: UserId, capturedLevel: RawAudioLevel, receivedLevel: RawAudioLevel): void;
|
|
76
|
+
renderVideoFrame(width: number, height: number, buffer: Buffer): void;
|
|
77
|
+
onSendOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, offerType: OfferType, opaque: Buffer): void;
|
|
78
|
+
onSendAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, opaque: Buffer): void;
|
|
79
|
+
onSendIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, candidates: Array<Buffer>): void;
|
|
80
|
+
onSendHangup(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, hangupType: HangupType, deviceId: DeviceId | null): void;
|
|
81
|
+
onSendBusy(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean): void;
|
|
82
|
+
private sendSignaling;
|
|
83
|
+
receivedHttpResponse(requestId: number, status: number, body: Buffer): void;
|
|
84
|
+
httpRequestFailed(requestId: number, debugInfo: string | undefined): void;
|
|
85
|
+
getGroupCall(groupId: Buffer, sfuUrl: string, hkdfExtraInfo: Buffer, audioLevelsIntervalMillis: number | undefined, observer: GroupCallObserver): GroupCall | undefined;
|
|
86
|
+
peekGroupCall(sfuUrl: string, membershipProof: Buffer, groupMembers: Array<GroupMemberInfo>): Promise<PeekInfo>;
|
|
87
|
+
requestMembershipProof(clientId: GroupCallClientId): void;
|
|
88
|
+
requestGroupMembers(clientId: GroupCallClientId): void;
|
|
89
|
+
handleConnectionStateChanged(clientId: GroupCallClientId, connectionState: ConnectionState): void;
|
|
90
|
+
handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void;
|
|
91
|
+
handleNetworkRouteChanged(clientId: GroupCallClientId, localNetworkAdapterType: NetworkAdapterType): void;
|
|
92
|
+
handleAudioLevels(clientId: GroupCallClientId, capturedLevel: RawAudioLevel, receivedLevels: Array<ReceivedAudioLevel>): void;
|
|
93
|
+
handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
|
|
94
|
+
handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
|
|
95
|
+
handlePeekResponse(request_id: number, info: PeekInfo): void;
|
|
96
|
+
handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
|
|
97
|
+
groupCallRingUpdate(groupId: GroupId, ringIdString: string, sender: GroupCallUserId, state: RingUpdate): void;
|
|
98
|
+
onLogMessage(level: number, fileName: string, line: number, message: string): void;
|
|
99
|
+
logError(message: string): void;
|
|
100
|
+
logWarn(message: string): void;
|
|
101
|
+
logInfo(message: string): void;
|
|
102
|
+
handleCallingMessage(remoteUserId: UserId, remoteUuid: Buffer | null, remoteDeviceId: DeviceId, localDeviceId: DeviceId, messageAgeSec: number, messageReceivedAtCounter: number, message: CallingMessage, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
|
|
103
|
+
sendHttpRequest(requestId: number, url: string, method: HttpMethod, headers: {
|
|
104
|
+
[name: string]: string;
|
|
105
|
+
}, body: Buffer | undefined): void;
|
|
106
|
+
sendCallMessage(recipientUuid: Buffer, message: Buffer, urgency: CallMessageUrgency): void;
|
|
107
|
+
sendCallMessageToGroup(groupId: Buffer, message: Buffer, urgency: CallMessageUrgency): void;
|
|
108
|
+
get call(): Call | null;
|
|
109
|
+
getCall(callId: CallId): Call | null;
|
|
110
|
+
accept(callId: CallId, asVideoCall: boolean): void;
|
|
111
|
+
decline(callId: CallId): void;
|
|
112
|
+
ignore(callId: CallId): void;
|
|
113
|
+
hangup(callId: CallId): void;
|
|
114
|
+
setOutgoingAudio(callId: CallId, enabled: boolean): void;
|
|
115
|
+
setOutgoingVideo(callId: CallId, enabled: boolean): void;
|
|
116
|
+
setOutgoingVideoIsScreenShare(callId: CallId, isScreenShare: boolean): void;
|
|
117
|
+
setVideoCapturer(callId: CallId, capturer: VideoCapturer | null): void;
|
|
118
|
+
setVideoRenderer(callId: CallId, renderer: VideoRenderer | null): void;
|
|
119
|
+
getAudioInputs(): AudioDevice[];
|
|
120
|
+
setAudioInput(index: number): void;
|
|
121
|
+
getAudioOutputs(): AudioDevice[];
|
|
122
|
+
setAudioOutput(index: number): void;
|
|
123
|
+
}
|
|
124
|
+
export interface CallSettings {
|
|
125
|
+
iceServer: IceServer;
|
|
126
|
+
hideIp: boolean;
|
|
127
|
+
bandwidthMode: BandwidthMode;
|
|
128
|
+
audioLevelsIntervalMillis?: number;
|
|
129
|
+
}
|
|
130
|
+
interface IceServer {
|
|
131
|
+
username?: string;
|
|
132
|
+
password?: string;
|
|
133
|
+
urls: Array<string>;
|
|
134
|
+
}
|
|
135
|
+
export interface AudioDevice {
|
|
136
|
+
name: string;
|
|
137
|
+
index: number;
|
|
138
|
+
uniqueId: string;
|
|
139
|
+
i18nKey?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface VideoCapturer {
|
|
142
|
+
enableCapture(): void;
|
|
143
|
+
enableCaptureAndSend(call: Call, captureOptions?: GumVideoCaptureOptions): void;
|
|
144
|
+
disable(): void;
|
|
145
|
+
}
|
|
146
|
+
export interface VideoRenderer {
|
|
147
|
+
enable(call: Call): void;
|
|
148
|
+
disable(): void;
|
|
149
|
+
}
|
|
150
|
+
export declare class Call {
|
|
151
|
+
private readonly _callManager;
|
|
152
|
+
private readonly _remoteUserId;
|
|
153
|
+
callId: CallId;
|
|
154
|
+
private readonly _isIncoming;
|
|
155
|
+
private readonly _isVideoCall;
|
|
156
|
+
settings: CallSettings | null;
|
|
157
|
+
private _state;
|
|
158
|
+
private _outgoingAudioEnabled;
|
|
159
|
+
private _outgoingVideoEnabled;
|
|
160
|
+
private _outgoingVideoIsScreenShare;
|
|
161
|
+
private _remoteVideoEnabled;
|
|
162
|
+
outgoingAudioLevel: NormalizedAudioLevel;
|
|
163
|
+
remoteAudioLevel: NormalizedAudioLevel;
|
|
164
|
+
remoteSharingScreen: boolean;
|
|
165
|
+
networkRoute: NetworkRoute;
|
|
166
|
+
private _videoCapturer;
|
|
167
|
+
private _videoRenderer;
|
|
168
|
+
endedReason?: CallEndedReason;
|
|
169
|
+
handleStateChanged?: () => void;
|
|
170
|
+
handleRemoteVideoEnabled?: () => void;
|
|
171
|
+
handleRemoteSharingScreen?: () => void;
|
|
172
|
+
handleNetworkRouteChanged?: () => void;
|
|
173
|
+
handleAudioLevels?: () => void;
|
|
174
|
+
renderVideoFrame?: (width: number, height: number, buffer: Buffer) => void;
|
|
175
|
+
constructor(callManager: CallManager, remoteUserId: UserId, callId: CallId, isIncoming: boolean, isVideoCall: boolean, settings: CallSettings | null, state: CallState);
|
|
176
|
+
get remoteUserId(): UserId;
|
|
177
|
+
get isIncoming(): boolean;
|
|
178
|
+
get isVideoCall(): boolean;
|
|
179
|
+
get state(): CallState;
|
|
180
|
+
set state(state: CallState);
|
|
181
|
+
setCallEnded(): void;
|
|
182
|
+
set videoCapturer(capturer: VideoCapturer | null);
|
|
183
|
+
set videoRenderer(renderer: VideoRenderer | null);
|
|
184
|
+
accept(): void;
|
|
185
|
+
decline(): void;
|
|
186
|
+
ignore(): void;
|
|
187
|
+
hangup(): void;
|
|
188
|
+
get outgoingAudioEnabled(): boolean;
|
|
189
|
+
set outgoingAudioEnabled(enabled: boolean);
|
|
190
|
+
get outgoingVideoEnabled(): boolean;
|
|
191
|
+
set outgoingVideoEnabled(enabled: boolean);
|
|
192
|
+
set outgoingVideoIsScreenShare(isScreenShare: boolean);
|
|
193
|
+
get remoteVideoEnabled(): boolean;
|
|
194
|
+
set remoteVideoEnabled(enabled: boolean);
|
|
195
|
+
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
196
|
+
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
|
|
197
|
+
private enableOrDisableCapturer;
|
|
198
|
+
private setOutgoingVideoEnabled;
|
|
199
|
+
updateBandwidthMode(bandwidthMode: BandwidthMode): void;
|
|
200
|
+
private enableOrDisableRenderer;
|
|
201
|
+
}
|
|
202
|
+
export declare type GroupCallClientId = number;
|
|
203
|
+
export declare enum ConnectionState {
|
|
204
|
+
NotConnected = 0,
|
|
205
|
+
Connecting = 1,
|
|
206
|
+
Connected = 2,
|
|
207
|
+
Reconnecting = 3
|
|
208
|
+
}
|
|
209
|
+
export declare enum JoinState {
|
|
210
|
+
NotJoined = 0,
|
|
211
|
+
Joining = 1,
|
|
212
|
+
Joined = 2
|
|
213
|
+
}
|
|
214
|
+
export declare enum GroupCallEndReason {
|
|
215
|
+
DeviceExplicitlyDisconnected = 0,
|
|
216
|
+
ServerExplicitlyDisconnected = 1,
|
|
217
|
+
CallManagerIsBusy = 2,
|
|
218
|
+
SfuClientFailedToJoin = 3,
|
|
219
|
+
FailedToCreatePeerConnectionFactory = 4,
|
|
220
|
+
FailedToNegotiateSrtpKeys = 5,
|
|
221
|
+
FailedToCreatePeerConnection = 6,
|
|
222
|
+
FailedToStartPeerConnection = 7,
|
|
223
|
+
FailedToUpdatePeerConnection = 8,
|
|
224
|
+
FailedToSetMaxSendBitrate = 9,
|
|
225
|
+
IceFailedWhileConnecting = 10,
|
|
226
|
+
IceFailedAfterConnected = 11,
|
|
227
|
+
ServerChangedDemuxId = 12,
|
|
228
|
+
HasMaxDevices = 13
|
|
229
|
+
}
|
|
230
|
+
export declare enum CallMessageUrgency {
|
|
231
|
+
Droppable = 0,
|
|
232
|
+
HandleImmediately = 1
|
|
233
|
+
}
|
|
234
|
+
export declare enum RingUpdate {
|
|
235
|
+
Requested = 0,
|
|
236
|
+
ExpiredRequest = 1,
|
|
237
|
+
AcceptedOnAnotherDevice = 2,
|
|
238
|
+
DeclinedOnAnotherDevice = 3,
|
|
239
|
+
BusyLocally = 4,
|
|
240
|
+
BusyOnAnotherDevice = 5,
|
|
241
|
+
CancelledByRinger = 6
|
|
242
|
+
}
|
|
243
|
+
export declare enum HttpMethod {
|
|
244
|
+
Get = 0,
|
|
245
|
+
Put = 1,
|
|
246
|
+
Post = 2,
|
|
247
|
+
Delete = 3
|
|
248
|
+
}
|
|
249
|
+
export declare class LocalDeviceState {
|
|
250
|
+
connectionState: ConnectionState;
|
|
251
|
+
joinState: JoinState;
|
|
252
|
+
demuxId?: number;
|
|
253
|
+
audioMuted: boolean;
|
|
254
|
+
videoMuted: boolean;
|
|
255
|
+
audioLevel: NormalizedAudioLevel;
|
|
256
|
+
presenting: boolean;
|
|
257
|
+
sharingScreen: boolean;
|
|
258
|
+
networkRoute: NetworkRoute;
|
|
259
|
+
constructor();
|
|
260
|
+
}
|
|
261
|
+
export declare class RemoteDeviceState {
|
|
262
|
+
demuxId: number;
|
|
263
|
+
userId: Buffer;
|
|
264
|
+
mediaKeysReceived: boolean;
|
|
265
|
+
audioMuted: boolean | undefined;
|
|
266
|
+
videoMuted: boolean | undefined;
|
|
267
|
+
audioLevel: NormalizedAudioLevel;
|
|
268
|
+
presenting: boolean | undefined;
|
|
269
|
+
sharingScreen: boolean | undefined;
|
|
270
|
+
videoAspectRatio: number | undefined;
|
|
271
|
+
addedTime: string | undefined;
|
|
272
|
+
speakerTime: string | undefined;
|
|
273
|
+
forwardingVideo: boolean | undefined;
|
|
274
|
+
isHigherResolutionPending: boolean;
|
|
275
|
+
constructor(demuxId: number, userId: Buffer, mediaKeysReceived: boolean);
|
|
276
|
+
}
|
|
277
|
+
export declare class GroupMemberInfo {
|
|
278
|
+
userId: Buffer;
|
|
279
|
+
userIdCipherText: Buffer;
|
|
280
|
+
constructor(userId: Buffer, userIdCipherText: Buffer);
|
|
281
|
+
}
|
|
282
|
+
export declare class VideoRequest {
|
|
283
|
+
demuxId: number;
|
|
284
|
+
width: number;
|
|
285
|
+
height: number;
|
|
286
|
+
framerate: number | undefined;
|
|
287
|
+
constructor(demuxId: number, width: number, height: number, framerate: number | undefined);
|
|
288
|
+
}
|
|
289
|
+
export interface GroupCallObserver {
|
|
290
|
+
requestMembershipProof(groupCall: GroupCall): void;
|
|
291
|
+
requestGroupMembers(groupCall: GroupCall): void;
|
|
292
|
+
onLocalDeviceStateChanged(groupCall: GroupCall): void;
|
|
293
|
+
onRemoteDeviceStatesChanged(groupCall: GroupCall): void;
|
|
294
|
+
onAudioLevels(groupCall: GroupCall): void;
|
|
295
|
+
onPeekChanged(groupCall: GroupCall): void;
|
|
296
|
+
onEnded(groupCall: GroupCall, reason: GroupCallEndReason): void;
|
|
297
|
+
}
|
|
298
|
+
export declare class GroupCall {
|
|
299
|
+
private readonly _callManager;
|
|
300
|
+
private readonly _observer;
|
|
301
|
+
private readonly _clientId;
|
|
302
|
+
get clientId(): GroupCallClientId;
|
|
303
|
+
private _localDeviceState;
|
|
304
|
+
private _remoteDeviceStates;
|
|
305
|
+
private _peekInfo;
|
|
306
|
+
constructor(callManager: CallManager, groupId: Buffer, sfuUrl: string, hkdfExtraInfo: Buffer, audioLevelsIntervalMillis: number | undefined, observer: GroupCallObserver);
|
|
307
|
+
connect(): void;
|
|
308
|
+
join(): void;
|
|
309
|
+
leave(): void;
|
|
310
|
+
disconnect(): void;
|
|
311
|
+
getLocalDeviceState(): LocalDeviceState;
|
|
312
|
+
getRemoteDeviceStates(): Array<RemoteDeviceState> | undefined;
|
|
313
|
+
getPeekInfo(): PeekInfo | undefined;
|
|
314
|
+
setOutgoingAudioMuted(muted: boolean): void;
|
|
315
|
+
setOutgoingVideoMuted(muted: boolean): void;
|
|
316
|
+
setPresenting(presenting: boolean): void;
|
|
317
|
+
setOutgoingVideoIsScreenShare(isScreenShare: boolean): void;
|
|
318
|
+
ringAll(): void;
|
|
319
|
+
resendMediaKeys(): void;
|
|
320
|
+
setBandwidthMode(bandwidthMode: BandwidthMode): void;
|
|
321
|
+
requestVideo(resolutions: Array<VideoRequest>, activeSpeakerHeight: number): void;
|
|
322
|
+
setGroupMembers(members: Array<GroupMemberInfo>): void;
|
|
323
|
+
setMembershipProof(proof: Buffer): void;
|
|
324
|
+
requestMembershipProof(): void;
|
|
325
|
+
requestGroupMembers(): void;
|
|
326
|
+
handleConnectionStateChanged(connectionState: ConnectionState): void;
|
|
327
|
+
handleJoinStateChanged(joinState: JoinState, demuxId: number | undefined): void;
|
|
328
|
+
handleNetworkRouteChanged(localNetworkAdapterType: NetworkAdapterType): void;
|
|
329
|
+
handleAudioLevels(capturedLevel: RawAudioLevel, receivedLevels: Array<ReceivedAudioLevel>): void;
|
|
330
|
+
handleRemoteDevicesChanged(remoteDeviceStates: Array<RemoteDeviceState>): void;
|
|
331
|
+
handlePeekChanged(info: PeekInfo): void;
|
|
332
|
+
handleEnded(reason: GroupCallEndReason): void;
|
|
333
|
+
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
334
|
+
getVideoSource(remoteDemuxId: number): GroupCallVideoFrameSource;
|
|
335
|
+
setRemoteAspectRatio(remoteDemuxId: number, aspectRatio: number): void;
|
|
336
|
+
}
|
|
337
|
+
declare class GroupCallVideoFrameSource {
|
|
338
|
+
private readonly _callManager;
|
|
339
|
+
private readonly _groupCall;
|
|
340
|
+
private readonly _remoteDemuxId;
|
|
341
|
+
constructor(callManager: CallManager, groupCall: GroupCall, remoteDemuxId: number);
|
|
342
|
+
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
|
|
343
|
+
}
|
|
344
|
+
declare type ProtobufBuffer = Buffer | {
|
|
345
|
+
toArrayBuffer: () => ArrayBuffer;
|
|
346
|
+
};
|
|
347
|
+
export declare type UserId = string;
|
|
348
|
+
export declare type DeviceId = number;
|
|
349
|
+
export declare type CallId = any;
|
|
350
|
+
export declare class CallingMessage {
|
|
351
|
+
offer?: OfferMessage;
|
|
352
|
+
answer?: AnswerMessage;
|
|
353
|
+
iceCandidates?: Array<IceCandidateMessage>;
|
|
354
|
+
legacyHangup?: HangupMessage;
|
|
355
|
+
busy?: BusyMessage;
|
|
356
|
+
hangup?: HangupMessage;
|
|
357
|
+
opaque?: OpaqueMessage;
|
|
358
|
+
supportsMultiRing?: boolean;
|
|
359
|
+
destinationDeviceId?: DeviceId;
|
|
360
|
+
}
|
|
361
|
+
export declare class OfferMessage {
|
|
362
|
+
callId?: CallId;
|
|
363
|
+
type?: OfferType;
|
|
364
|
+
opaque?: ProtobufBuffer;
|
|
365
|
+
sdp?: string;
|
|
366
|
+
}
|
|
367
|
+
export declare enum OfferType {
|
|
368
|
+
AudioCall = 0,
|
|
369
|
+
VideoCall = 1
|
|
370
|
+
}
|
|
371
|
+
export declare class AnswerMessage {
|
|
372
|
+
callId?: CallId;
|
|
373
|
+
opaque?: ProtobufBuffer;
|
|
374
|
+
sdp?: string;
|
|
375
|
+
}
|
|
376
|
+
export declare class IceCandidateMessage {
|
|
377
|
+
callId?: CallId;
|
|
378
|
+
mid?: string;
|
|
379
|
+
line?: number;
|
|
380
|
+
opaque?: ProtobufBuffer;
|
|
381
|
+
sdp?: string;
|
|
382
|
+
}
|
|
383
|
+
export declare class BusyMessage {
|
|
384
|
+
callId?: CallId;
|
|
385
|
+
}
|
|
386
|
+
export declare class HangupMessage {
|
|
387
|
+
callId?: CallId;
|
|
388
|
+
type?: HangupType;
|
|
389
|
+
deviceId?: DeviceId;
|
|
390
|
+
}
|
|
391
|
+
export declare class OpaqueMessage {
|
|
392
|
+
data?: ProtobufBuffer;
|
|
393
|
+
}
|
|
394
|
+
export declare enum HangupType {
|
|
395
|
+
Normal = 0,
|
|
396
|
+
Accepted = 1,
|
|
397
|
+
Declined = 2,
|
|
398
|
+
Busy = 3,
|
|
399
|
+
NeedPermission = 4
|
|
400
|
+
}
|
|
401
|
+
export declare enum BandwidthMode {
|
|
402
|
+
VeryLow = 0,
|
|
403
|
+
Low = 1,
|
|
404
|
+
Normal = 2
|
|
405
|
+
}
|
|
406
|
+
export declare enum RingCancelReason {
|
|
407
|
+
DeclinedByUser = 0,
|
|
408
|
+
Busy = 1
|
|
409
|
+
}
|
|
410
|
+
export interface CallManager {
|
|
411
|
+
setConfig(config: Config): void;
|
|
412
|
+
setSelfUuid(uuid: Buffer): void;
|
|
413
|
+
createOutgoingCall(remoteUserId: UserId, isVideoCall: boolean, localDeviceId: DeviceId): CallId;
|
|
414
|
+
proceed(callId: CallId, iceServerUsername: string, iceServerPassword: string, iceServerUrls: Array<string>, hideIp: boolean, bandwidthMode: BandwidthMode, audioLevelsIntervalMillis: number): void;
|
|
415
|
+
accept(callId: CallId): void;
|
|
416
|
+
ignore(callId: CallId): void;
|
|
417
|
+
hangup(): void;
|
|
418
|
+
cancelGroupRing(groupId: GroupId, ringId: string, reason: RingCancelReason | null): void;
|
|
419
|
+
signalingMessageSent(callId: CallId): void;
|
|
420
|
+
signalingMessageSendFailed(callId: CallId): void;
|
|
421
|
+
setOutgoingAudioEnabled(enabled: boolean): void;
|
|
422
|
+
setOutgoingVideoEnabled(enabled: boolean): void;
|
|
423
|
+
setOutgoingVideoIsScreenShare(enabled: boolean): void;
|
|
424
|
+
updateBandwidthMode(bandwidthMode: BandwidthMode): void;
|
|
425
|
+
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
426
|
+
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
|
|
427
|
+
receivedOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, messageAgeSec: number, callId: CallId, offerType: OfferType, localDeviceId: DeviceId, opaque: Buffer, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
|
|
428
|
+
receivedAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, opaque: Buffer, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
|
|
429
|
+
receivedIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, candidates: Array<Buffer>): void;
|
|
430
|
+
receivedHangup(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, hangupType: HangupType, hangupDeviceId: DeviceId | null): void;
|
|
431
|
+
receivedBusy(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId): void;
|
|
432
|
+
receivedCallMessage(remoteUserId: Buffer, remoteDeviceId: DeviceId, localDeviceId: DeviceId, data: Buffer, messageAgeSec: number): void;
|
|
433
|
+
receivedHttpResponse(requestId: number, status: number, body: Buffer): void;
|
|
434
|
+
httpRequestFailed(requestId: number, debugInfo: string | undefined): void;
|
|
435
|
+
createGroupCallClient(groupId: Buffer, sfuUrl: string, hkdfExtraInfo: Buffer, audioLevelsIntervalMillis: number): GroupCallClientId;
|
|
436
|
+
deleteGroupCallClient(clientId: GroupCallClientId): void;
|
|
437
|
+
connect(clientId: GroupCallClientId): void;
|
|
438
|
+
join(clientId: GroupCallClientId): void;
|
|
439
|
+
leave(clientId: GroupCallClientId): void;
|
|
440
|
+
disconnect(clientId: GroupCallClientId): void;
|
|
441
|
+
setOutgoingAudioMuted(clientId: GroupCallClientId, muted: boolean): void;
|
|
442
|
+
setOutgoingVideoMuted(clientId: GroupCallClientId, muted: boolean): void;
|
|
443
|
+
setPresenting(clientId: GroupCallClientId, presenting: boolean): void;
|
|
444
|
+
setOutgoingGroupCallVideoIsScreenShare(clientId: GroupCallClientId, isScreenShare: boolean): void;
|
|
445
|
+
groupRing(clientId: GroupCallClientId, recipient: Buffer | undefined): void;
|
|
446
|
+
resendMediaKeys(clientId: GroupCallClientId): void;
|
|
447
|
+
setBandwidthMode(clientId: GroupCallClientId, bandwidthMode: BandwidthMode): void;
|
|
448
|
+
requestVideo(clientId: GroupCallClientId, resolutions: Array<VideoRequest>, activeSpeakerHeight: number): void;
|
|
449
|
+
setGroupMembers(clientId: GroupCallClientId, members: Array<GroupMemberInfo>): void;
|
|
450
|
+
setMembershipProof(clientId: GroupCallClientId, proof: Buffer): void;
|
|
451
|
+
receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Buffer): [number, number] | undefined;
|
|
452
|
+
peekGroupCall(requestId: number, sfu_url: string, membership_proof: Buffer, group_members: Array<GroupMemberInfo>): Promise<PeekInfo>;
|
|
453
|
+
getAudioInputs(): AudioDevice[];
|
|
454
|
+
setAudioInput(index: number): void;
|
|
455
|
+
getAudioOutputs(): AudioDevice[];
|
|
456
|
+
setAudioOutput(index: number): void;
|
|
457
|
+
}
|
|
458
|
+
export interface CallManagerCallbacks {
|
|
459
|
+
onStartOutgoingCall(remoteUserId: UserId, callId: CallId): void;
|
|
460
|
+
onStartIncomingCall(remoteUserId: UserId, callId: CallId, isVideoCall: boolean): void;
|
|
461
|
+
onCallState(remoteUserId: UserId, state: CallState): void;
|
|
462
|
+
onCallEnded(remoteUserId: UserId, callId: CallId, endedReason: CallEndedReason, ageSec: number): void;
|
|
463
|
+
onRemoteVideoEnabled(remoteUserId: UserId, enabled: boolean): void;
|
|
464
|
+
onRemoteSharingScreen(remoteUserId: UserId, enabled: boolean): void;
|
|
465
|
+
onSendOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, mediaType: number, opaque: Buffer): void;
|
|
466
|
+
onSendAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, opaque: Buffer): void;
|
|
467
|
+
onSendIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, candidates: Array<Buffer>): void;
|
|
468
|
+
onSendHangup(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, HangupType: HangupType, hangupDeviceId: DeviceId | null): void;
|
|
469
|
+
onSendBusy(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean): void;
|
|
470
|
+
sendCallMessage(recipientUuid: Buffer, message: Buffer, urgency: CallMessageUrgency): void;
|
|
471
|
+
sendCallMessageToGroup(groupId: Buffer, message: Buffer, urgency: CallMessageUrgency): void;
|
|
472
|
+
sendHttpRequest(requestId: number, url: string, method: HttpMethod, headers: {
|
|
473
|
+
[name: string]: string;
|
|
474
|
+
}, body: Buffer | undefined): void;
|
|
475
|
+
requestMembershipProof(clientId: GroupCallClientId): void;
|
|
476
|
+
requestGroupMembers(clientId: GroupCallClientId): void;
|
|
477
|
+
handleConnectionStateChanged(clientId: GroupCallClientId, connectionState: ConnectionState): void;
|
|
478
|
+
handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void;
|
|
479
|
+
handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
|
|
480
|
+
handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
|
|
481
|
+
handlePeekResponse(request_id: number, info: PeekInfo): void;
|
|
482
|
+
handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
|
|
483
|
+
onLogMessage(level: number, fileName: string, line: number, message: string): void;
|
|
484
|
+
}
|
|
485
|
+
export declare enum CallState {
|
|
486
|
+
Prering = "idle",
|
|
487
|
+
Ringing = "ringing",
|
|
488
|
+
Accepted = "connected",
|
|
489
|
+
Reconnecting = "connecting",
|
|
490
|
+
Ended = "ended"
|
|
491
|
+
}
|
|
492
|
+
export declare enum CallEndedReason {
|
|
493
|
+
LocalHangup = "LocalHangup",
|
|
494
|
+
RemoteHangup = "RemoteHangup",
|
|
495
|
+
RemoteHangupNeedPermission = "RemoteHangupNeedPermission",
|
|
496
|
+
Declined = "Declined",
|
|
497
|
+
Busy = "Busy",
|
|
498
|
+
Glare = "Glare",
|
|
499
|
+
ReCall = "ReCall",
|
|
500
|
+
ReceivedOfferExpired = "ReceivedOfferExpired",
|
|
501
|
+
ReceivedOfferWhileActive = "ReceivedOfferWhileActive",
|
|
502
|
+
ReceivedOfferWithGlare = "ReceivedOfferWithGlare",
|
|
503
|
+
SignalingFailure = "SignalingFailure",
|
|
504
|
+
GlareFailure = "GlareFailure",
|
|
505
|
+
ConnectionFailure = "ConnectionFailure",
|
|
506
|
+
InternalFailure = "InternalFailure",
|
|
507
|
+
Timeout = "Timeout",
|
|
508
|
+
AcceptedOnAnotherDevice = "AcceptedOnAnotherDevice",
|
|
509
|
+
DeclinedOnAnotherDevice = "DeclinedOnAnotherDevice",
|
|
510
|
+
BusyOnAnotherDevice = "BusyOnAnotherDevice"
|
|
511
|
+
}
|
|
512
|
+
export declare enum CallLogLevel {
|
|
513
|
+
Off = 0,
|
|
514
|
+
Error = 1,
|
|
515
|
+
Warn = 2,
|
|
516
|
+
Info = 3,
|
|
517
|
+
Debug = 4,
|
|
518
|
+
Trace = 5
|
|
519
|
+
}
|
|
520
|
+
export {};
|