@sawport/peers-caller 1.0.0-alpha.16 → 1.0.0-alpha.17
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/README.md +39 -2
- package/dist/core/PeersCaller.d.ts +4 -0
- package/dist/core/PeersCaller.d.ts.map +1 -1
- package/dist/peers-caller.es.js +77 -37
- package/dist/peers-caller.es.js.map +1 -1
- package/dist/peers-caller.umd.js +4 -4
- package/dist/peers-caller.umd.js.map +1 -1
- package/dist/store/tester.store.d.ts +1 -0
- package/dist/store/tester.store.d.ts.map +1 -1
- package/dist/tester/App.d.ts.map +1 -1
- package/dist/tester/components/ConfigPanel.d.ts +1 -0
- package/dist/tester/components/ConfigPanel.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -369,8 +369,10 @@ function RecordingControls() {
|
|
|
369
369
|
const handleStartRecording = async () => {
|
|
370
370
|
try {
|
|
371
371
|
await startRecording({
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
id: `rec-${Date.now()}`,
|
|
373
|
+
filename: `recording-${Date.now()}.webm`,
|
|
374
|
+
roomId: peersCaller.roomId,
|
|
375
|
+
startTime: Date.now()
|
|
374
376
|
});
|
|
375
377
|
console.log('Recording started');
|
|
376
378
|
} catch (error) {
|
|
@@ -389,6 +391,41 @@ function RecordingControls() {
|
|
|
389
391
|
);
|
|
390
392
|
}
|
|
391
393
|
|
|
394
|
+
// Auto Recording - Automatically start recording when call begins
|
|
395
|
+
const peersCallerWithAutoRecording = new PeersCaller({
|
|
396
|
+
roomId: 'conversation-123',
|
|
397
|
+
user: { id: 'user-456' },
|
|
398
|
+
token: 'your-jwt-token',
|
|
399
|
+
socketUrl: 'https://your-server.com',
|
|
400
|
+
autoRecording: true,
|
|
401
|
+
getRecordingOptions: async () => {
|
|
402
|
+
// This callback is called when the call starts or when user joins
|
|
403
|
+
// You can make API calls here to get recording metadata
|
|
404
|
+
const recordingId = `rec-${Date.now()}`;
|
|
405
|
+
const filename = `recording-${Date.now()}.webm`;
|
|
406
|
+
|
|
407
|
+
return {
|
|
408
|
+
recordingData: {
|
|
409
|
+
id: recordingId,
|
|
410
|
+
filename: filename,
|
|
411
|
+
roomId: 'conversation-123',
|
|
412
|
+
startTime: Date.now(),
|
|
413
|
+
conversationId: 'conv-123' // Optional: Link to your conversation system
|
|
414
|
+
},
|
|
415
|
+
config: {
|
|
416
|
+
mimeType: 'video/webm;codecs=vp9,opus',
|
|
417
|
+
videoBitsPerSecond: 100000,
|
|
418
|
+
audioBitsPerSecond: 128000,
|
|
419
|
+
interval: 5000 // Send chunks every 5 seconds
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}, {
|
|
424
|
+
onRecordingStateChanged: (isRecording) => {
|
|
425
|
+
console.log('Recording state changed:', isRecording);
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
|
|
392
429
|
function CallInterface() {
|
|
393
430
|
return (
|
|
394
431
|
<div className="call-interface">
|
|
@@ -64,6 +64,10 @@ export declare class PeersCaller extends BaseStore<CallStore> {
|
|
|
64
64
|
* Stop recording
|
|
65
65
|
*/
|
|
66
66
|
stopRecording(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Handle auto recording if enabled in config
|
|
69
|
+
*/
|
|
70
|
+
private handleAutoRecording;
|
|
67
71
|
/**
|
|
68
72
|
* Get current call state
|
|
69
73
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeersCaller.d.ts","sourceRoot":"","sources":["../../src/core/PeersCaller.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KA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AAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI3D;;OAEG;IACH,YAAY,IAAI,GAAG;IA6BnB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB9B;;OAEG;YACW,0BAA0B;IAqBxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA4I5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;YACW,uBAAuB;IAwFrC;;OAEG;IACG,eAAe;IAiCrB;;OAEG;YACW,WAAW;IAgCzB;;OAEG;YACW,YAAY;IAgC1B;;OAEG;YACW,eAAe;IAmC7B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAUpC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;OAEG;YACW,eAAe;IAyC7B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAU/B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;YACW,eAAe;IA6B7B;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAkD9B"}
|
package/dist/peers-caller.es.js
CHANGED
|
@@ -783,13 +783,13 @@ Cn.write = function(r, e, t, s, c, l) {
|
|
|
783
783
|
return n = n >>> 0, o || J(n, 4, this.length), (this[n] | this[n + 1] << 8 | this[n + 2] << 16) + this[n + 3] * 16777216;
|
|
784
784
|
}, h.prototype.readUint32BE = h.prototype.readUInt32BE = function(n, o) {
|
|
785
785
|
return n = n >>> 0, o || J(n, 4, this.length), this[n] * 16777216 + (this[n + 1] << 16 | this[n + 2] << 8 | this[n + 3]);
|
|
786
|
-
}, h.prototype.readBigUInt64LE =
|
|
786
|
+
}, h.prototype.readBigUInt64LE = Be(function(n) {
|
|
787
787
|
n = n >>> 0, ne(n, "offset");
|
|
788
788
|
const o = this[n], _ = this[n + 7];
|
|
789
789
|
(o === void 0 || _ === void 0) && ae(n, this.length - 8);
|
|
790
790
|
const M = o + this[++n] * ie(2, 8) + this[++n] * ie(2, 16) + this[++n] * ie(2, 24), x = this[++n] + this[++n] * ie(2, 8) + this[++n] * ie(2, 16) + _ * ie(2, 24);
|
|
791
791
|
return BigInt(M) + (BigInt(x) << BigInt(32));
|
|
792
|
-
}), h.prototype.readBigUInt64BE =
|
|
792
|
+
}), h.prototype.readBigUInt64BE = Be(function(n) {
|
|
793
793
|
n = n >>> 0, ne(n, "offset");
|
|
794
794
|
const o = this[n], _ = this[n + 7];
|
|
795
795
|
(o === void 0 || _ === void 0) && ae(n, this.length - 8);
|
|
@@ -821,13 +821,13 @@ Cn.write = function(r, e, t, s, c, l) {
|
|
|
821
821
|
return n = n >>> 0, o || J(n, 4, this.length), this[n] | this[n + 1] << 8 | this[n + 2] << 16 | this[n + 3] << 24;
|
|
822
822
|
}, h.prototype.readInt32BE = function(n, o) {
|
|
823
823
|
return n = n >>> 0, o || J(n, 4, this.length), this[n] << 24 | this[n + 1] << 16 | this[n + 2] << 8 | this[n + 3];
|
|
824
|
-
}, h.prototype.readBigInt64LE =
|
|
824
|
+
}, h.prototype.readBigInt64LE = Be(function(n) {
|
|
825
825
|
n = n >>> 0, ne(n, "offset");
|
|
826
826
|
const o = this[n], _ = this[n + 7];
|
|
827
827
|
(o === void 0 || _ === void 0) && ae(n, this.length - 8);
|
|
828
828
|
const M = this[n + 4] + this[n + 5] * ie(2, 8) + this[n + 6] * ie(2, 16) + (_ << 24);
|
|
829
829
|
return (BigInt(M) << BigInt(32)) + BigInt(o + this[++n] * ie(2, 8) + this[++n] * ie(2, 16) + this[++n] * ie(2, 24));
|
|
830
|
-
}), h.prototype.readBigInt64BE =
|
|
830
|
+
}), h.prototype.readBigInt64BE = Be(function(n) {
|
|
831
831
|
n = n >>> 0, ne(n, "offset");
|
|
832
832
|
const o = this[n], _ = this[n + 7];
|
|
833
833
|
(o === void 0 || _ === void 0) && ae(n, this.length - 8);
|
|
@@ -891,9 +891,9 @@ Cn.write = function(r, e, t, s, c, l) {
|
|
|
891
891
|
let Y = Number(n >> BigInt(32) & BigInt(4294967295));
|
|
892
892
|
return d[o + 3] = Y, Y = Y >> 8, d[o + 2] = Y, Y = Y >> 8, d[o + 1] = Y, Y = Y >> 8, d[o] = Y, o + 8;
|
|
893
893
|
}
|
|
894
|
-
h.prototype.writeBigUInt64LE =
|
|
894
|
+
h.prototype.writeBigUInt64LE = Be(function(n, o = 0) {
|
|
895
895
|
return D(this, n, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
896
|
-
}), h.prototype.writeBigUInt64BE =
|
|
896
|
+
}), h.prototype.writeBigUInt64BE = Be(function(n, o = 0) {
|
|
897
897
|
return F(this, n, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
898
898
|
}), h.prototype.writeIntLE = function(n, o, _, M) {
|
|
899
899
|
if (n = +n, o = o >>> 0, !M) {
|
|
@@ -923,9 +923,9 @@ Cn.write = function(r, e, t, s, c, l) {
|
|
|
923
923
|
return n = +n, o = o >>> 0, _ || re(this, n, o, 4, 2147483647, -2147483648), this[o] = n & 255, this[o + 1] = n >>> 8, this[o + 2] = n >>> 16, this[o + 3] = n >>> 24, o + 4;
|
|
924
924
|
}, h.prototype.writeInt32BE = function(n, o, _) {
|
|
925
925
|
return n = +n, o = o >>> 0, _ || re(this, n, o, 4, 2147483647, -2147483648), n < 0 && (n = 4294967295 + n + 1), this[o] = n >>> 24, this[o + 1] = n >>> 16, this[o + 2] = n >>> 8, this[o + 3] = n & 255, o + 4;
|
|
926
|
-
}, h.prototype.writeBigInt64LE =
|
|
926
|
+
}, h.prototype.writeBigInt64LE = Be(function(n, o = 0) {
|
|
927
927
|
return D(this, n, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
928
|
-
}), h.prototype.writeBigInt64BE =
|
|
928
|
+
}), h.prototype.writeBigInt64BE = Be(function(n, o = 0) {
|
|
929
929
|
return F(this, n, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
930
930
|
});
|
|
931
931
|
function G(d, n, o, _, M, x) {
|
|
@@ -1163,7 +1163,7 @@ Cn.write = function(r, e, t, s, c, l) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
return n;
|
|
1165
1165
|
}();
|
|
1166
|
-
function
|
|
1166
|
+
function Be(d) {
|
|
1167
1167
|
return typeof BigInt == "undefined" ? Qe : d;
|
|
1168
1168
|
}
|
|
1169
1169
|
function Qe() {
|
|
@@ -2898,13 +2898,13 @@ function mt() {
|
|
|
2898
2898
|
}, U.prototype.writeFloatBE = function(i, a, E) {
|
|
2899
2899
|
return qe(this, i, a, !1, E);
|
|
2900
2900
|
};
|
|
2901
|
-
function
|
|
2901
|
+
function Be(p, i, a, E, N) {
|
|
2902
2902
|
return i = +i, a = a >>> 0, N || je(p, i, a, 8), T.write(p, i, a, E, 52, 8), a + 8;
|
|
2903
2903
|
}
|
|
2904
2904
|
U.prototype.writeDoubleLE = function(i, a, E) {
|
|
2905
|
-
return
|
|
2905
|
+
return Be(this, i, a, !0, E);
|
|
2906
2906
|
}, U.prototype.writeDoubleBE = function(i, a, E) {
|
|
2907
|
-
return
|
|
2907
|
+
return Be(this, i, a, !1, E);
|
|
2908
2908
|
}, U.prototype.copy = function(i, a, E, N) {
|
|
2909
2909
|
if (!U.isBuffer(i)) throw new TypeError("argument should be a Buffer");
|
|
2910
2910
|
if (E || (E = 0), !N && N !== 0 && (N = this.length), a >= i.length && (a = i.length), a || (a = 0), N > 0 && N < E && (N = E), N === E || i.length === 0 || this.length === 0) return 0;
|
|
@@ -6058,8 +6058,8 @@ function Ho() {
|
|
|
6058
6058
|
ee.pipesCount += 1, u("pipe count=%d opts=%j", ee.pipesCount, w);
|
|
6059
6059
|
var se = (!w || w.end !== !1) && v !== oe.stdout && v !== oe.stderr, ne = se ? Oe : je;
|
|
6060
6060
|
ee.endEmitted ? oe.nextTick(ne) : z.once("end", ne), v.on("unpipe", ae);
|
|
6061
|
-
function ae(qe,
|
|
6062
|
-
u("onunpipe"), qe === z &&
|
|
6061
|
+
function ae(qe, Be) {
|
|
6062
|
+
u("onunpipe"), qe === z && Be && Be.hasUnpiped === !1 && (Be.hasUnpiped = !0, Le());
|
|
6063
6063
|
}
|
|
6064
6064
|
function Oe() {
|
|
6065
6065
|
u("onend"), v.end();
|
|
@@ -6073,8 +6073,8 @@ function Ho() {
|
|
|
6073
6073
|
z.on("data", de);
|
|
6074
6074
|
function de(qe) {
|
|
6075
6075
|
u("ondata");
|
|
6076
|
-
var
|
|
6077
|
-
u("dest.write",
|
|
6076
|
+
var Be = v.write(qe);
|
|
6077
|
+
u("dest.write", Be), Be === !1 && ((ee.pipesCount === 1 && ee.pipes === v || ee.pipesCount > 1 && Q(ee.pipes, v) !== -1) && !Me && (u("false write response, pause", ee.awaitDrain), ee.awaitDrain++), z.pause());
|
|
6078
6078
|
}
|
|
6079
6079
|
function ye(qe) {
|
|
6080
6080
|
u("onerror", qe), je(), v.removeListener("error", ye), e(v, "error") === 0 && O(v, qe);
|
|
@@ -7586,6 +7586,7 @@ const go = {
|
|
|
7586
7586
|
userId: "",
|
|
7587
7587
|
token: "",
|
|
7588
7588
|
apiUrl: "http://127.0.0.1:5000",
|
|
7589
|
+
autoRecording: !1,
|
|
7589
7590
|
iceServers: [
|
|
7590
7591
|
{ urls: "stun:stun.l.google.com:19302" },
|
|
7591
7592
|
{ urls: "stun:stun1.l.google.com:19302" }
|
|
@@ -8486,7 +8487,7 @@ var hl = Object.defineProperty, dl = Object.defineProperties, pl = Object.getOwn
|
|
|
8486
8487
|
for (var t of _o(e))
|
|
8487
8488
|
yl.call(e, t) && En(r, t, e[t]);
|
|
8488
8489
|
return r;
|
|
8489
|
-
}, Co = (r, e) => dl(r, pl(e)), Ge = (r, e, t) => En(r, typeof e != "symbol" ? e + "" : e, t),
|
|
8490
|
+
}, Co = (r, e) => dl(r, pl(e)), Ge = (r, e, t) => En(r, typeof e != "symbol" ? e + "" : e, t), Ie = (r, e, t) => new Promise((s, c) => {
|
|
8490
8491
|
var l = (u) => {
|
|
8491
8492
|
try {
|
|
8492
8493
|
f(t.next(u));
|
|
@@ -8534,7 +8535,7 @@ class ml extends Zo {
|
|
|
8534
8535
|
* Initialize the PeersCaller and establish WebSocket connection
|
|
8535
8536
|
*/
|
|
8536
8537
|
initialize() {
|
|
8537
|
-
return
|
|
8538
|
+
return Ie(this, null, function* () {
|
|
8538
8539
|
try {
|
|
8539
8540
|
if (console.log("[PeersCaller] Initializing..."), this.isInitialized) {
|
|
8540
8541
|
console.warn("[PeersCaller] Already initialized");
|
|
@@ -8552,7 +8553,7 @@ class ml extends Zo {
|
|
|
8552
8553
|
* Start a new call
|
|
8553
8554
|
*/
|
|
8554
8555
|
startCall() {
|
|
8555
|
-
return
|
|
8556
|
+
return Ie(this, arguments, function* (e = this.config.mediaConfig) {
|
|
8556
8557
|
var t, s;
|
|
8557
8558
|
try {
|
|
8558
8559
|
if (console.log("[PeersCaller] Starting call..."), this.isInitialized || (yield this.initialize()), yield this.initializeLocalParticipant(), this.localParticipant && !this.localParticipant.getCurrentStream()) {
|
|
@@ -8572,7 +8573,7 @@ class ml extends Zo {
|
|
|
8572
8573
|
const l = c.participants.map(
|
|
8573
8574
|
(g) => typeof g == "string" ? { id: g } : g
|
|
8574
8575
|
);
|
|
8575
|
-
(s = (t = this.callbacks).onCallStarted) == null || s.call(t, Co(Eo({}, c), { participants: l }));
|
|
8576
|
+
(s = (t = this.callbacks).onCallStarted) == null || s.call(t, Co(Eo({}, c), { participants: l })), yield this.handleAutoRecording();
|
|
8576
8577
|
} else {
|
|
8577
8578
|
this.state.setIsCalling(!1), this.state.setCallStatus("idle");
|
|
8578
8579
|
const l = "Failed to start call on server";
|
|
@@ -8587,7 +8588,7 @@ class ml extends Zo {
|
|
|
8587
8588
|
* Join an existing call
|
|
8588
8589
|
*/
|
|
8589
8590
|
joinCall() {
|
|
8590
|
-
return
|
|
8591
|
+
return Ie(this, arguments, function* (e = this.config.mediaConfig) {
|
|
8591
8592
|
try {
|
|
8592
8593
|
console.log("[PeersCaller] Joining call..."), this.isInitialized || (yield this.initialize()), yield this.initializeLocalParticipant();
|
|
8593
8594
|
const t = yield this.checkCallStatus();
|
|
@@ -8615,7 +8616,7 @@ class ml extends Zo {
|
|
|
8615
8616
|
)), s.participants.forEach((c) => {
|
|
8616
8617
|
const l = typeof c == "string" ? { id: c } : c;
|
|
8617
8618
|
l.id !== this.config.user.id && this.handleParticipantJoined(l);
|
|
8618
|
-
}), console.log("[PeersCaller] Joined call successfully");
|
|
8619
|
+
}), console.log("[PeersCaller] Joined call successfully"), yield this.handleAutoRecording();
|
|
8619
8620
|
} catch (t) {
|
|
8620
8621
|
throw console.error("[PeersCaller] Failed to join call:", t), this.state.setCallStatus("idle"), this.handleError("INVALID_ROOM_ID", `Failed to join call: ${t}`), t;
|
|
8621
8622
|
}
|
|
@@ -8626,7 +8627,7 @@ class ml extends Zo {
|
|
|
8626
8627
|
* This sends a request to the server to end the call for all participants
|
|
8627
8628
|
*/
|
|
8628
8629
|
endCall() {
|
|
8629
|
-
return
|
|
8630
|
+
return Ie(this, null, function* () {
|
|
8630
8631
|
try {
|
|
8631
8632
|
console.log("[PeersCaller] Ending call..."), this.recorder && this.state.isRecording && (yield this.stopRecording());
|
|
8632
8633
|
try {
|
|
@@ -8647,7 +8648,7 @@ class ml extends Zo {
|
|
|
8647
8648
|
* Leave the call gracefully (with server acknowledgement)
|
|
8648
8649
|
*/
|
|
8649
8650
|
leaveCall() {
|
|
8650
|
-
return
|
|
8651
|
+
return Ie(this, null, function* () {
|
|
8651
8652
|
try {
|
|
8652
8653
|
console.log("[PeersCaller] Leaving call..."), console.log("[PeersCaller] Leaving call for room:", this.config.roomId);
|
|
8653
8654
|
const e = yield this.socket.leaveCall(this.config.roomId);
|
|
@@ -8678,7 +8679,7 @@ class ml extends Zo {
|
|
|
8678
8679
|
* Start screen sharing
|
|
8679
8680
|
*/
|
|
8680
8681
|
startScreenShare() {
|
|
8681
|
-
return
|
|
8682
|
+
return Ie(this, null, function* () {
|
|
8682
8683
|
try {
|
|
8683
8684
|
if (!this.localParticipant)
|
|
8684
8685
|
throw new Error("Local participant not initialized");
|
|
@@ -8695,7 +8696,7 @@ class ml extends Zo {
|
|
|
8695
8696
|
* Stop screen sharing
|
|
8696
8697
|
*/
|
|
8697
8698
|
stopScreenShare() {
|
|
8698
|
-
return
|
|
8699
|
+
return Ie(this, null, function* () {
|
|
8699
8700
|
try {
|
|
8700
8701
|
if (!this.localParticipant)
|
|
8701
8702
|
throw new Error("Local participant not initialized");
|
|
@@ -8709,7 +8710,7 @@ class ml extends Zo {
|
|
|
8709
8710
|
* Start recording the call
|
|
8710
8711
|
*/
|
|
8711
8712
|
startRecording(e, t) {
|
|
8712
|
-
return
|
|
8713
|
+
return Ie(this, null, function* () {
|
|
8713
8714
|
var s;
|
|
8714
8715
|
try {
|
|
8715
8716
|
if (console.log("[PeersCaller] Starting recording..."), this.state.isRecording) {
|
|
@@ -8761,7 +8762,7 @@ class ml extends Zo {
|
|
|
8761
8762
|
* Stop recording
|
|
8762
8763
|
*/
|
|
8763
8764
|
stopRecording() {
|
|
8764
|
-
return
|
|
8765
|
+
return Ie(this, null, function* () {
|
|
8765
8766
|
try {
|
|
8766
8767
|
if (console.log("[PeersCaller] Stopping recording..."), !this.recorder || !this.state.isRecording) {
|
|
8767
8768
|
console.warn("[PeersCaller] No active recording to stop");
|
|
@@ -8773,6 +8774,45 @@ class ml extends Zo {
|
|
|
8773
8774
|
}
|
|
8774
8775
|
});
|
|
8775
8776
|
}
|
|
8777
|
+
/**
|
|
8778
|
+
* Handle auto recording if enabled in config
|
|
8779
|
+
*/
|
|
8780
|
+
handleAutoRecording() {
|
|
8781
|
+
return Ie(this, null, function* () {
|
|
8782
|
+
if (this.config.autoRecording) {
|
|
8783
|
+
if (this.state.isRecording) {
|
|
8784
|
+
console.log(
|
|
8785
|
+
"[PeersCaller] Recording already in progress, skipping auto recording"
|
|
8786
|
+
);
|
|
8787
|
+
return;
|
|
8788
|
+
}
|
|
8789
|
+
if (!this.config.getRecordingOptions) {
|
|
8790
|
+
console.warn(
|
|
8791
|
+
"[PeersCaller] Auto recording enabled but getRecordingOptions callback not provided"
|
|
8792
|
+
);
|
|
8793
|
+
return;
|
|
8794
|
+
}
|
|
8795
|
+
try {
|
|
8796
|
+
console.log(
|
|
8797
|
+
"[PeersCaller] Auto recording enabled, fetching recording options..."
|
|
8798
|
+
);
|
|
8799
|
+
const e = yield this.config.getRecordingOptions();
|
|
8800
|
+
if (!e || !e.recordingData) {
|
|
8801
|
+
console.warn(
|
|
8802
|
+
"[PeersCaller] getRecordingOptions did not return valid recording data"
|
|
8803
|
+
);
|
|
8804
|
+
return;
|
|
8805
|
+
}
|
|
8806
|
+
console.log(
|
|
8807
|
+
"[PeersCaller] Starting auto recording with options:",
|
|
8808
|
+
e.recordingData
|
|
8809
|
+
), yield this.startRecording(e.recordingData, e.config);
|
|
8810
|
+
} catch (e) {
|
|
8811
|
+
console.error("[PeersCaller] Failed to start auto recording:", e), this.handleError("RECORDING_FAILED", `Auto recording failed: ${e}`);
|
|
8812
|
+
}
|
|
8813
|
+
}
|
|
8814
|
+
});
|
|
8815
|
+
}
|
|
8776
8816
|
/**
|
|
8777
8817
|
* Get current call state
|
|
8778
8818
|
*/
|
|
@@ -8824,7 +8864,7 @@ class ml extends Zo {
|
|
|
8824
8864
|
* Cleanup and disconnect
|
|
8825
8865
|
*/
|
|
8826
8866
|
cleanup() {
|
|
8827
|
-
return
|
|
8867
|
+
return Ie(this, null, function* () {
|
|
8828
8868
|
console.log("[PeersCaller] Cleaning up..."), this.state.isCalling && (yield this.endCall()), this.cleanupSocketListeners(), this.cleanupAllParticipants(), this.recorder && (this.recorder.cleanup(), this.recorder = null), this.socket.disconnect(), this.state.resetCall(), this.isInitialized = !1, console.log("[PeersCaller] Cleanup completed");
|
|
8829
8869
|
});
|
|
8830
8870
|
}
|
|
@@ -8832,7 +8872,7 @@ class ml extends Zo {
|
|
|
8832
8872
|
* Initialize local participant
|
|
8833
8873
|
*/
|
|
8834
8874
|
initializeLocalParticipant() {
|
|
8835
|
-
return
|
|
8875
|
+
return Ie(this, null, function* () {
|
|
8836
8876
|
this.localParticipant || (this.localParticipant = new wo(
|
|
8837
8877
|
this.config.user,
|
|
8838
8878
|
{
|
|
@@ -8945,7 +8985,7 @@ class ml extends Zo {
|
|
|
8945
8985
|
* Handle participant joined
|
|
8946
8986
|
*/
|
|
8947
8987
|
handleParticipantJoined(e) {
|
|
8948
|
-
return
|
|
8988
|
+
return Ie(this, null, function* () {
|
|
8949
8989
|
var t, s;
|
|
8950
8990
|
try {
|
|
8951
8991
|
if (e.id === this.config.user.id || this.participants.has(e.id))
|
|
@@ -9019,7 +9059,7 @@ class ml extends Zo {
|
|
|
9019
9059
|
* Check call status for the conversation
|
|
9020
9060
|
*/
|
|
9021
9061
|
checkCallStatus() {
|
|
9022
|
-
return
|
|
9062
|
+
return Ie(this, null, function* () {
|
|
9023
9063
|
try {
|
|
9024
9064
|
if (console.log("[PeersCaller] Checking call status..."), !this.socket.isConnected())
|
|
9025
9065
|
throw new Error("Socket not connected");
|
|
@@ -9040,7 +9080,7 @@ class ml extends Zo {
|
|
|
9040
9080
|
* Handle WebRTC offer
|
|
9041
9081
|
*/
|
|
9042
9082
|
handleOffer(e, t) {
|
|
9043
|
-
return
|
|
9083
|
+
return Ie(this, null, function* () {
|
|
9044
9084
|
try {
|
|
9045
9085
|
if (!this.localParticipant) {
|
|
9046
9086
|
console.warn(
|
|
@@ -9064,7 +9104,7 @@ class ml extends Zo {
|
|
|
9064
9104
|
* Handle WebRTC answer
|
|
9065
9105
|
*/
|
|
9066
9106
|
handleAnswer(e, t) {
|
|
9067
|
-
return
|
|
9107
|
+
return Ie(this, null, function* () {
|
|
9068
9108
|
try {
|
|
9069
9109
|
if (!this.localParticipant) {
|
|
9070
9110
|
console.warn(
|
|
@@ -9088,7 +9128,7 @@ class ml extends Zo {
|
|
|
9088
9128
|
* Handle ICE candidate
|
|
9089
9129
|
*/
|
|
9090
9130
|
handleCandidate(e, t) {
|
|
9091
|
-
return
|
|
9131
|
+
return Ie(this, null, function* () {
|
|
9092
9132
|
try {
|
|
9093
9133
|
if (!this.localParticipant) {
|
|
9094
9134
|
console.warn(
|
|
@@ -9135,7 +9175,7 @@ class ml extends Zo {
|
|
|
9135
9175
|
* Handle call ended notification from server
|
|
9136
9176
|
*/
|
|
9137
9177
|
handleCallEnded(e) {
|
|
9138
|
-
return
|
|
9178
|
+
return Ie(this, null, function* () {
|
|
9139
9179
|
var t, s;
|
|
9140
9180
|
const c = typeof e.endedBy == "string" ? { id: e.endedBy } : e.endedBy;
|
|
9141
9181
|
console.log(
|
|
@@ -9185,7 +9225,7 @@ class ml extends Zo {
|
|
|
9185
9225
|
* Fetch ICE servers from the backend
|
|
9186
9226
|
*/
|
|
9187
9227
|
fetchIceServers() {
|
|
9188
|
-
return
|
|
9228
|
+
return Ie(this, null, function* () {
|
|
9189
9229
|
try {
|
|
9190
9230
|
console.log("[PeersCaller] Fetching ICE servers from backend...");
|
|
9191
9231
|
const e = yield this.socket.getIceServers(this.roomId);
|