@signalapp/ringrtc 2.50.4 → 2.51.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/acknowledgments.md +286 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3 -8
- package/dist/ringrtc/Service.d.ts +48 -26
- package/dist/ringrtc/Service.js +94 -161
- package/package.json +2 -4
- package/dist/ringrtc/VideoSupport.d.ts +0 -77
- package/dist/ringrtc/VideoSupport.js +0 -433
package/dist/ringrtc/Service.js
CHANGED
|
@@ -7,8 +7,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.CallLogLevel = exports.CallEndedReason = exports.CallState = exports.RingCancelReason = exports.DataMode = exports.HangupType = exports.OpaqueMessage = exports.HangupMessage = exports.BusyMessage = exports.IceCandidateMessage = exports.AnswerMessage = exports.OfferType = exports.OfferMessage = exports.CallingMessage = exports.GroupCall = exports.GroupCallKind = exports.VideoRequest = exports.GroupMemberInfo = exports.RemoteDeviceState = exports.LocalDeviceState = exports.HttpMethod = exports.RingUpdate = exports.CallMessageUrgency = exports.SpeechEvent = exports.GroupCallEndReason = exports.JoinState = exports.ConnectionState = exports.Call = exports.RingRTCType = exports.ReceivedAudioLevel = exports.NetworkRoute = exports.PeekStatusCodes = exports.callIdFromEra = void 0;
|
|
10
|
+
exports.CallLogLevel = exports.CallEndedReason = exports.CallState = exports.RingCancelReason = exports.DataMode = exports.HangupType = exports.OpaqueMessage = exports.HangupMessage = exports.BusyMessage = exports.IceCandidateMessage = exports.AnswerMessage = exports.OfferType = exports.OfferMessage = exports.CallingMessage = exports.GroupCall = exports.GroupCallKind = exports.VideoRequest = exports.GroupMemberInfo = exports.RemoteDeviceState = exports.LocalDeviceState = exports.HttpMethod = exports.RingUpdate = exports.CallMessageUrgency = exports.SpeechEvent = exports.GroupCallEndReason = exports.JoinState = exports.ConnectionState = exports.Call = exports.VideoPixelFormatEnum = exports.RingRTCType = exports.ReceivedAudioLevel = exports.NetworkRoute = exports.PeekStatusCodes = exports.callIdFromEra = void 0;
|
|
11
11
|
exports.callIdFromRingId = callIdFromRingId;
|
|
12
|
+
exports.videoPixelFormatToEnum = videoPixelFormatToEnum;
|
|
13
|
+
/* eslint-disable max-classes-per-file */
|
|
12
14
|
const CallLinks_1 = require("./CallLinks");
|
|
13
15
|
const Native_1 = __importDefault(require("./Native"));
|
|
14
16
|
const INVALID_CLIENT_ID = 0;
|
|
@@ -287,7 +289,6 @@ class RingRTCType {
|
|
|
287
289
|
const isIncoming = false;
|
|
288
290
|
const call = new Call(this.callManager, remoteUserId, callId, isIncoming, isVideoCall, CallState.Prering);
|
|
289
291
|
this._call = call;
|
|
290
|
-
call.outgoingVideoEnabled = isVideoCall;
|
|
291
292
|
return call;
|
|
292
293
|
}
|
|
293
294
|
// Called by UX
|
|
@@ -1111,14 +1112,12 @@ class RingRTCType {
|
|
|
1111
1112
|
}
|
|
1112
1113
|
return null;
|
|
1113
1114
|
}
|
|
1114
|
-
accept(callId
|
|
1115
|
+
accept(callId) {
|
|
1115
1116
|
const call = this.getCall(callId);
|
|
1116
1117
|
if (!call) {
|
|
1117
1118
|
return;
|
|
1118
1119
|
}
|
|
1119
1120
|
call.accept();
|
|
1120
|
-
call.outgoingAudioEnabled = true;
|
|
1121
|
-
call.outgoingVideoEnabled = asVideoCall;
|
|
1122
1121
|
}
|
|
1123
1122
|
decline(callId) {
|
|
1124
1123
|
const call = this.getCall(callId);
|
|
@@ -1141,41 +1140,6 @@ class RingRTCType {
|
|
|
1141
1140
|
}
|
|
1142
1141
|
call.hangup();
|
|
1143
1142
|
}
|
|
1144
|
-
setOutgoingAudio(callId, enabled) {
|
|
1145
|
-
const call = this.getCall(callId);
|
|
1146
|
-
if (!call) {
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
call.outgoingAudioEnabled = enabled;
|
|
1150
|
-
}
|
|
1151
|
-
setOutgoingVideo(callId, enabled) {
|
|
1152
|
-
const call = this.getCall(callId);
|
|
1153
|
-
if (!call) {
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
call.outgoingVideoEnabled = enabled;
|
|
1157
|
-
}
|
|
1158
|
-
setOutgoingVideoIsScreenShare(callId, isScreenShare) {
|
|
1159
|
-
const call = this.getCall(callId);
|
|
1160
|
-
if (!call) {
|
|
1161
|
-
return;
|
|
1162
|
-
}
|
|
1163
|
-
call.outgoingVideoIsScreenShare = isScreenShare;
|
|
1164
|
-
}
|
|
1165
|
-
setVideoCapturer(callId, capturer) {
|
|
1166
|
-
const call = this.getCall(callId);
|
|
1167
|
-
if (!call) {
|
|
1168
|
-
return;
|
|
1169
|
-
}
|
|
1170
|
-
call.videoCapturer = capturer;
|
|
1171
|
-
}
|
|
1172
|
-
setVideoRenderer(callId, renderer) {
|
|
1173
|
-
const call = this.getCall(callId);
|
|
1174
|
-
if (!call) {
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
call.videoRenderer = renderer;
|
|
1178
|
-
}
|
|
1179
1143
|
getAudioInputs() {
|
|
1180
1144
|
return this.callManager.getAudioInputs();
|
|
1181
1145
|
}
|
|
@@ -1190,8 +1154,30 @@ class RingRTCType {
|
|
|
1190
1154
|
}
|
|
1191
1155
|
}
|
|
1192
1156
|
exports.RingRTCType = RingRTCType;
|
|
1157
|
+
// Given a weird name to not conflict with WebCodec's VideoPixelFormat
|
|
1158
|
+
var VideoPixelFormatEnum;
|
|
1159
|
+
(function (VideoPixelFormatEnum) {
|
|
1160
|
+
VideoPixelFormatEnum[VideoPixelFormatEnum["I420"] = 0] = "I420";
|
|
1161
|
+
VideoPixelFormatEnum[VideoPixelFormatEnum["Nv12"] = 1] = "Nv12";
|
|
1162
|
+
VideoPixelFormatEnum[VideoPixelFormatEnum["Rgba"] = 2] = "Rgba";
|
|
1163
|
+
})(VideoPixelFormatEnum || (exports.VideoPixelFormatEnum = VideoPixelFormatEnum = {}));
|
|
1164
|
+
function videoPixelFormatToEnum(format) {
|
|
1165
|
+
switch (format) {
|
|
1166
|
+
case 'I420': {
|
|
1167
|
+
return VideoPixelFormatEnum.I420;
|
|
1168
|
+
}
|
|
1169
|
+
case 'NV12': {
|
|
1170
|
+
return VideoPixelFormatEnum.Nv12;
|
|
1171
|
+
}
|
|
1172
|
+
case 'RGBA': {
|
|
1173
|
+
return VideoPixelFormatEnum.Rgba;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1193
1177
|
class Call {
|
|
1194
1178
|
constructor(callManager, remoteUserId, callId, isIncoming, isVideoCall, state) {
|
|
1179
|
+
// Media state flags.
|
|
1180
|
+
this._mediaSessionStarted = false;
|
|
1195
1181
|
this._outgoingAudioEnabled = false;
|
|
1196
1182
|
this._outgoingVideoEnabled = false;
|
|
1197
1183
|
this._outgoingVideoIsScreenShare = false;
|
|
@@ -1201,8 +1187,6 @@ class Call {
|
|
|
1201
1187
|
this.remoteAudioLevel = 0;
|
|
1202
1188
|
this.remoteSharingScreen = false;
|
|
1203
1189
|
this.networkRoute = new NetworkRoute();
|
|
1204
|
-
this._videoCapturer = null;
|
|
1205
|
-
this._videoRenderer = null;
|
|
1206
1190
|
this._callManager = callManager;
|
|
1207
1191
|
this._remoteUserId = remoteUserId;
|
|
1208
1192
|
this.callId = callId;
|
|
@@ -1228,11 +1212,39 @@ class Call {
|
|
|
1228
1212
|
}
|
|
1229
1213
|
this._state = state;
|
|
1230
1214
|
if (state === CallState.Accepted) {
|
|
1231
|
-
//
|
|
1232
|
-
this.
|
|
1215
|
+
// We might have been in the reconnecting state and already started media.
|
|
1216
|
+
if (!this._mediaSessionStarted) {
|
|
1217
|
+
sillyDeadlockProtection(() => {
|
|
1218
|
+
if (this._outgoingAudioEnabled) {
|
|
1219
|
+
this._callManager.setOutgoingAudioEnabled(true);
|
|
1220
|
+
}
|
|
1221
|
+
if (this._outgoingVideoIsScreenShare) {
|
|
1222
|
+
this._callManager.setOutgoingVideoIsScreenShare(true);
|
|
1223
|
+
this._callManager.setOutgoingVideoEnabled(true);
|
|
1224
|
+
}
|
|
1225
|
+
else if (this._outgoingVideoEnabled) {
|
|
1226
|
+
this._callManager.setOutgoingVideoEnabled(true);
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
this._mediaSessionStarted = true;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
else if (state === CallState.Ended) {
|
|
1233
|
+
if (this._mediaSessionStarted) {
|
|
1234
|
+
sillyDeadlockProtection(() => {
|
|
1235
|
+
if (this._outgoingAudioEnabled) {
|
|
1236
|
+
this._callManager.setOutgoingAudioEnabled(false);
|
|
1237
|
+
}
|
|
1238
|
+
if (this._outgoingVideoEnabled) {
|
|
1239
|
+
this._callManager.setOutgoingVideoEnabled(false);
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
this._outgoingAudioEnabled = false;
|
|
1243
|
+
this._outgoingVideoEnabled = false;
|
|
1244
|
+
this._outgoingVideoIsScreenShare = false;
|
|
1245
|
+
this._mediaSessionStarted = false;
|
|
1246
|
+
}
|
|
1233
1247
|
}
|
|
1234
|
-
this.enableOrDisableCapturer();
|
|
1235
|
-
this.enableOrDisableRenderer();
|
|
1236
1248
|
if (this.handleStateChanged) {
|
|
1237
1249
|
this.handleStateChanged();
|
|
1238
1250
|
}
|
|
@@ -1240,14 +1252,6 @@ class Call {
|
|
|
1240
1252
|
setCallEnded() {
|
|
1241
1253
|
this._state = CallState.Ended;
|
|
1242
1254
|
}
|
|
1243
|
-
set videoCapturer(capturer) {
|
|
1244
|
-
this._videoCapturer = capturer;
|
|
1245
|
-
this.enableOrDisableCapturer();
|
|
1246
|
-
}
|
|
1247
|
-
set videoRenderer(renderer) {
|
|
1248
|
-
this._videoRenderer = renderer;
|
|
1249
|
-
this.enableOrDisableRenderer();
|
|
1250
|
-
}
|
|
1251
1255
|
accept() {
|
|
1252
1256
|
this._callManager.accept(this.callId);
|
|
1253
1257
|
}
|
|
@@ -1258,43 +1262,10 @@ class Call {
|
|
|
1258
1262
|
this._callManager.ignore(this.callId);
|
|
1259
1263
|
}
|
|
1260
1264
|
hangup() {
|
|
1261
|
-
// This is a little faster than waiting for the
|
|
1262
|
-
// change in call state to come back.
|
|
1263
|
-
if (this._videoCapturer) {
|
|
1264
|
-
this._videoCapturer.disable();
|
|
1265
|
-
}
|
|
1266
|
-
if (this._videoRenderer) {
|
|
1267
|
-
this._videoRenderer.disable();
|
|
1268
|
-
}
|
|
1269
|
-
// This assumes we only have one active call.
|
|
1270
1265
|
sillyDeadlockProtection(() => {
|
|
1271
1266
|
this._callManager.hangup();
|
|
1272
1267
|
});
|
|
1273
1268
|
}
|
|
1274
|
-
get outgoingAudioEnabled() {
|
|
1275
|
-
return this._outgoingAudioEnabled;
|
|
1276
|
-
}
|
|
1277
|
-
set outgoingAudioEnabled(enabled) {
|
|
1278
|
-
this._outgoingAudioEnabled = enabled;
|
|
1279
|
-
// This assumes we only have one active call.
|
|
1280
|
-
sillyDeadlockProtection(() => {
|
|
1281
|
-
this._callManager.setOutgoingAudioEnabled(enabled);
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
get outgoingVideoEnabled() {
|
|
1285
|
-
return this._outgoingVideoEnabled;
|
|
1286
|
-
}
|
|
1287
|
-
set outgoingVideoEnabled(enabled) {
|
|
1288
|
-
this._outgoingVideoEnabled = enabled;
|
|
1289
|
-
this.enableOrDisableCapturer();
|
|
1290
|
-
}
|
|
1291
|
-
set outgoingVideoIsScreenShare(isScreenShare) {
|
|
1292
|
-
// This assumes we only have one active call.
|
|
1293
|
-
this._outgoingVideoIsScreenShare = isScreenShare;
|
|
1294
|
-
sillyDeadlockProtection(() => {
|
|
1295
|
-
this._callManager.setOutgoingVideoIsScreenShare(isScreenShare);
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
1269
|
get remoteAudioEnabled() {
|
|
1299
1270
|
return this._remoteAudioEnabled;
|
|
1300
1271
|
}
|
|
@@ -1306,63 +1277,51 @@ class Call {
|
|
|
1306
1277
|
}
|
|
1307
1278
|
set remoteVideoEnabled(enabled) {
|
|
1308
1279
|
this._remoteVideoEnabled = enabled;
|
|
1309
|
-
|
|
1280
|
+
}
|
|
1281
|
+
setOutgoingAudioMuted(muted) {
|
|
1282
|
+
const enabled = !muted;
|
|
1283
|
+
if (this._mediaSessionStarted && this._outgoingAudioEnabled !== enabled) {
|
|
1284
|
+
this._outgoingAudioEnabled = enabled;
|
|
1285
|
+
sillyDeadlockProtection(() => {
|
|
1286
|
+
this._callManager.setOutgoingAudioEnabled(enabled);
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
else {
|
|
1290
|
+
this._outgoingAudioEnabled = enabled;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
setOutgoingVideoMuted(muted) {
|
|
1294
|
+
const enabled = !muted;
|
|
1295
|
+
if (this._mediaSessionStarted && this._outgoingVideoEnabled !== enabled) {
|
|
1296
|
+
this._outgoingVideoEnabled = enabled;
|
|
1297
|
+
sillyDeadlockProtection(() => {
|
|
1298
|
+
this._callManager.setOutgoingVideoEnabled(enabled);
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
this._outgoingVideoEnabled = enabled;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
setOutgoingVideoIsScreenShare(isScreenShare) {
|
|
1306
|
+
if (this._mediaSessionStarted &&
|
|
1307
|
+
this._outgoingVideoIsScreenShare !== isScreenShare) {
|
|
1308
|
+
this._outgoingVideoIsScreenShare = isScreenShare;
|
|
1309
|
+
sillyDeadlockProtection(() => {
|
|
1310
|
+
this._callManager.setOutgoingVideoIsScreenShare(isScreenShare);
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
else {
|
|
1314
|
+
this._outgoingVideoIsScreenShare = isScreenShare;
|
|
1315
|
+
}
|
|
1310
1316
|
}
|
|
1311
1317
|
// With this method, a Call is a VideoFrameSender
|
|
1312
1318
|
sendVideoFrame(width, height, format, buffer) {
|
|
1313
|
-
// This assumes we only have one active call.
|
|
1314
1319
|
this._callManager.sendVideoFrame(width, height, format, buffer);
|
|
1315
1320
|
}
|
|
1316
1321
|
// With this method, a Call is a VideoFrameSource
|
|
1317
1322
|
receiveVideoFrame(buffer, maxWidth, maxHeight) {
|
|
1318
|
-
// This assumes we only have one active call.
|
|
1319
1323
|
return this._callManager.receiveVideoFrame(buffer, maxWidth, maxHeight);
|
|
1320
1324
|
}
|
|
1321
|
-
enableOrDisableCapturer() {
|
|
1322
|
-
if (!this._videoCapturer) {
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
if (!this.outgoingVideoEnabled) {
|
|
1326
|
-
this._videoCapturer.disable();
|
|
1327
|
-
if (this.state === CallState.Accepted) {
|
|
1328
|
-
this.setOutgoingVideoEnabled(false);
|
|
1329
|
-
}
|
|
1330
|
-
return;
|
|
1331
|
-
}
|
|
1332
|
-
switch (this.state) {
|
|
1333
|
-
case CallState.Prering:
|
|
1334
|
-
case CallState.Ringing:
|
|
1335
|
-
this._videoCapturer.enableCapture();
|
|
1336
|
-
break;
|
|
1337
|
-
case CallState.Accepted:
|
|
1338
|
-
this._videoCapturer.enableCaptureAndSend(this);
|
|
1339
|
-
this.setOutgoingVideoEnabled(true);
|
|
1340
|
-
if (this._outgoingVideoIsScreenShare) {
|
|
1341
|
-
// Make sure the status gets sent.
|
|
1342
|
-
this.outgoingVideoIsScreenShare = true;
|
|
1343
|
-
}
|
|
1344
|
-
break;
|
|
1345
|
-
case CallState.Reconnecting:
|
|
1346
|
-
this._videoCapturer.enableCaptureAndSend(this);
|
|
1347
|
-
// Don't send status until we're reconnected.
|
|
1348
|
-
break;
|
|
1349
|
-
case CallState.Ended:
|
|
1350
|
-
this._videoCapturer.disable();
|
|
1351
|
-
break;
|
|
1352
|
-
default:
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
setOutgoingVideoEnabled(enabled) {
|
|
1356
|
-
sillyDeadlockProtection(() => {
|
|
1357
|
-
try {
|
|
1358
|
-
this._callManager.setOutgoingVideoEnabled(enabled);
|
|
1359
|
-
}
|
|
1360
|
-
catch {
|
|
1361
|
-
// We may not have an active connection any more.
|
|
1362
|
-
// In which case it doesn't matter
|
|
1363
|
-
}
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
1325
|
updateDataMode(dataMode) {
|
|
1367
1326
|
sillyDeadlockProtection(() => {
|
|
1368
1327
|
try {
|
|
@@ -1374,29 +1333,6 @@ class Call {
|
|
|
1374
1333
|
}
|
|
1375
1334
|
});
|
|
1376
1335
|
}
|
|
1377
|
-
enableOrDisableRenderer() {
|
|
1378
|
-
if (!this._videoRenderer) {
|
|
1379
|
-
return;
|
|
1380
|
-
}
|
|
1381
|
-
if (!this.remoteVideoEnabled) {
|
|
1382
|
-
this._videoRenderer.disable();
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
switch (this.state) {
|
|
1386
|
-
case CallState.Prering:
|
|
1387
|
-
case CallState.Ringing:
|
|
1388
|
-
this._videoRenderer.disable();
|
|
1389
|
-
break;
|
|
1390
|
-
case CallState.Accepted:
|
|
1391
|
-
case CallState.Reconnecting:
|
|
1392
|
-
this._videoRenderer.enable(this);
|
|
1393
|
-
break;
|
|
1394
|
-
case CallState.Ended:
|
|
1395
|
-
this._videoRenderer.disable();
|
|
1396
|
-
break;
|
|
1397
|
-
default:
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
1336
|
}
|
|
1401
1337
|
exports.Call = Call;
|
|
1402
1338
|
// Represents the connection state to a media server for a group call.
|
|
@@ -1722,7 +1658,6 @@ class GroupCall {
|
|
|
1722
1658
|
}
|
|
1723
1659
|
// With this, a GroupCall is a VideoFrameSender
|
|
1724
1660
|
sendVideoFrame(width, height, format, buffer) {
|
|
1725
|
-
// This assumes we only have one active call.
|
|
1726
1661
|
this._callManager.sendVideoFrame(width, height, format, buffer);
|
|
1727
1662
|
}
|
|
1728
1663
|
// With this, a GroupCall can provide a VideoFrameSource for each remote device.
|
|
@@ -1745,7 +1680,6 @@ class GroupCall {
|
|
|
1745
1680
|
}
|
|
1746
1681
|
}
|
|
1747
1682
|
exports.GroupCall = GroupCall;
|
|
1748
|
-
// Implements VideoSource for use in CanvasVideoRenderer
|
|
1749
1683
|
class GroupCallVideoFrameSource {
|
|
1750
1684
|
constructor(callManager, groupCall, remoteDemuxId // Uint32
|
|
1751
1685
|
) {
|
|
@@ -1754,7 +1688,6 @@ class GroupCallVideoFrameSource {
|
|
|
1754
1688
|
this._remoteDemuxId = remoteDemuxId;
|
|
1755
1689
|
}
|
|
1756
1690
|
receiveVideoFrame(buffer, maxWidth, maxHeight) {
|
|
1757
|
-
// This assumes we only have one active call.
|
|
1758
1691
|
const frame = this._callManager.receiveGroupCallVideoFrame(this._groupCall.clientId, this._remoteDemuxId, buffer, maxWidth, maxHeight);
|
|
1759
1692
|
if (frame) {
|
|
1760
1693
|
const [width, height] = frame;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/ringrtc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"description": "Signal Messenger voice and video calling library.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"config": {
|
|
27
27
|
"prebuildUrl": "https://build-artifacts.signal.org/libraries/ringrtc-desktop-build-v${npm_package_version}.tar.gz",
|
|
28
|
-
"prebuildChecksum": "
|
|
28
|
+
"prebuildChecksum": "77621836d3b47b8a4a5ba81941b9bdf1f27e9b70187ca2b00e8e467d0292f137"
|
|
29
29
|
},
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "AGPL-3.0-only",
|
|
@@ -36,11 +36,9 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/chai": "4.3.16",
|
|
38
38
|
"@types/chai-as-promised": "^7.1.4",
|
|
39
|
-
"@types/dom-mediacapture-transform": "0.1.10",
|
|
40
39
|
"@types/lodash": "^4.14.106",
|
|
41
40
|
"@types/mocha": "10.0.9",
|
|
42
41
|
"@types/node": "20.17.6",
|
|
43
|
-
"@types/offscreencanvas": "^2019.7.3",
|
|
44
42
|
"@types/sinon-chai": "^3.2.12",
|
|
45
43
|
"chai": "4.4.1",
|
|
46
44
|
"chai-as-promised": "^7.1.1",
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
interface Ref<T> {
|
|
2
|
-
readonly current: T | null;
|
|
3
|
-
}
|
|
4
|
-
export declare enum VideoPixelFormatEnum {
|
|
5
|
-
I420 = 0,
|
|
6
|
-
Nv12 = 1,
|
|
7
|
-
Rgba = 2
|
|
8
|
-
}
|
|
9
|
-
export interface VideoFrameSource {
|
|
10
|
-
/**
|
|
11
|
-
* Copies the latest frame into `buffer`.
|
|
12
|
-
*
|
|
13
|
-
* Note that `maxWidth` and `maxHeight` specify maximum dimensions,
|
|
14
|
-
* but allow for rotation, i.e. a maximum of 1920x1080 will also allow
|
|
15
|
-
* portrait-mode 1080x1920.
|
|
16
|
-
*
|
|
17
|
-
* Returns a `[width, height]` pair for the resulting frame,
|
|
18
|
-
* or `undefined` if there's no new frame ready to be displayed.
|
|
19
|
-
*/
|
|
20
|
-
receiveVideoFrame(buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
21
|
-
}
|
|
22
|
-
interface VideoFrameSender {
|
|
23
|
-
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
24
|
-
}
|
|
25
|
-
export declare class GumVideoCaptureOptions {
|
|
26
|
-
maxWidth: number;
|
|
27
|
-
maxHeight: number;
|
|
28
|
-
maxFramerate: number;
|
|
29
|
-
preferredDeviceId?: string;
|
|
30
|
-
screenShareSourceId?: string;
|
|
31
|
-
mediaStream?: MediaStream;
|
|
32
|
-
onEnded?: () => void;
|
|
33
|
-
}
|
|
34
|
-
export declare class GumVideoCapturer {
|
|
35
|
-
private defaultCaptureOptions;
|
|
36
|
-
private localPreview?;
|
|
37
|
-
private captureOptions?;
|
|
38
|
-
private sender?;
|
|
39
|
-
private mediaStream?;
|
|
40
|
-
private spawnedSenderRunning;
|
|
41
|
-
private preferredDeviceId?;
|
|
42
|
-
private updateLocalPreviewIntervalId?;
|
|
43
|
-
constructor(defaultCaptureOptions: GumVideoCaptureOptions);
|
|
44
|
-
capturing(): boolean;
|
|
45
|
-
setLocalPreview(localPreview: Ref<HTMLVideoElement> | undefined): void;
|
|
46
|
-
enableCapture(options?: GumVideoCaptureOptions): Promise<void>;
|
|
47
|
-
enableCaptureAndSend(sender?: VideoFrameSender, options?: GumVideoCaptureOptions): Promise<void>;
|
|
48
|
-
disable(): void;
|
|
49
|
-
setPreferredDevice(deviceId: string): Promise<void>;
|
|
50
|
-
enumerateDevices(): Promise<Array<MediaDeviceInfo>>;
|
|
51
|
-
private getUserMedia;
|
|
52
|
-
private startCapturing;
|
|
53
|
-
private stopCapturing;
|
|
54
|
-
private startSending;
|
|
55
|
-
private spawnSender;
|
|
56
|
-
private stopSending;
|
|
57
|
-
private updateLocalPreviewSourceObject;
|
|
58
|
-
}
|
|
59
|
-
export declare const MAX_VIDEO_CAPTURE_WIDTH: number;
|
|
60
|
-
export declare const MAX_VIDEO_CAPTURE_HEIGHT: number;
|
|
61
|
-
export declare const MAX_VIDEO_CAPTURE_AREA: number;
|
|
62
|
-
export declare const MAX_VIDEO_CAPTURE_BUFFER_SIZE: number;
|
|
63
|
-
export declare class CanvasVideoRenderer {
|
|
64
|
-
private canvas?;
|
|
65
|
-
private buffer;
|
|
66
|
-
private imageData?;
|
|
67
|
-
private source?;
|
|
68
|
-
private rafId?;
|
|
69
|
-
constructor();
|
|
70
|
-
setCanvas(canvas: Ref<HTMLCanvasElement> | undefined): void;
|
|
71
|
-
enable(source: VideoFrameSource): void;
|
|
72
|
-
disable(): void;
|
|
73
|
-
private requestAnimationFrameCallback;
|
|
74
|
-
private renderBlack;
|
|
75
|
-
private renderVideoFrame;
|
|
76
|
-
}
|
|
77
|
-
export {};
|