livekit-client 1.6.4 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/livekit-client.esm.mjs +264 -33
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +13 -2
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/proto/livekit_models.d.ts +10 -0
- package/dist/src/proto/livekit_models.d.ts.map +1 -1
- package/dist/src/proto/livekit_rtc.d.ts +2395 -384
- package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +13 -2
- package/dist/ts4.2/src/proto/livekit_models.d.ts +10 -0
- package/dist/ts4.2/src/proto/livekit_rtc.d.ts +2567 -440
- package/package.json +1 -1
- package/src/api/SignalClient.ts +41 -2
- package/src/proto/livekit_models.ts +51 -0
- package/src/proto/livekit_rtc.ts +210 -3
- package/src/room/RTCEngine.ts +35 -14
- package/src/room/Room.ts +8 -4
- package/src/room/participant/LocalParticipant.ts +7 -3
- package/src/room/track/LocalAudioTrack.ts +5 -1
@@ -4288,6 +4288,15 @@ function disconnectReasonToJSON(object) {
|
|
4288
4288
|
return "UNRECOGNIZED";
|
4289
4289
|
}
|
4290
4290
|
}
|
4291
|
+
var ReconnectReason;
|
4292
|
+
(function (ReconnectReason) {
|
4293
|
+
ReconnectReason[ReconnectReason["REASON_UNKOWN"] = 0] = "REASON_UNKOWN";
|
4294
|
+
ReconnectReason[ReconnectReason["REASON_SIGNAL_DISCONNECTED"] = 1] = "REASON_SIGNAL_DISCONNECTED";
|
4295
|
+
ReconnectReason[ReconnectReason["REASON_PUBLISHER_FAILED"] = 2] = "REASON_PUBLISHER_FAILED";
|
4296
|
+
ReconnectReason[ReconnectReason["REASON_SUBSCRIBER_FAILED"] = 3] = "REASON_SUBSCRIBER_FAILED";
|
4297
|
+
ReconnectReason[ReconnectReason["REASON_SWITCH_CANDIDATE"] = 4] = "REASON_SWITCH_CANDIDATE";
|
4298
|
+
ReconnectReason[ReconnectReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
4299
|
+
})(ReconnectReason || (ReconnectReason = {}));
|
4291
4300
|
var ParticipantInfo_State;
|
4292
4301
|
(function (ParticipantInfo_State) {
|
4293
4302
|
/** JOINING - websocket' connected, but not offered yet */
|
@@ -9417,7 +9426,7 @@ function createBaseSignalRequest() {
|
|
9417
9426
|
const SignalRequest = {
|
9418
9427
|
encode(message) {
|
9419
9428
|
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
|
9420
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
9429
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
9421
9430
|
if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer") {
|
9422
9431
|
SessionDescription.encode(message.message.offer, writer.uint32(10).fork()).ldelim();
|
9423
9432
|
}
|
@@ -9460,6 +9469,9 @@ const SignalRequest = {
|
|
9460
9469
|
if (((_p = message.message) === null || _p === void 0 ? void 0 : _p.$case) === "updateMetadata") {
|
9461
9470
|
UpdateParticipantMetadata.encode(message.message.updateMetadata, writer.uint32(122).fork()).ldelim();
|
9462
9471
|
}
|
9472
|
+
if (((_q = message.message) === null || _q === void 0 ? void 0 : _q.$case) === "pingReq") {
|
9473
|
+
Ping.encode(message.message.pingReq, writer.uint32(130).fork()).ldelim();
|
9474
|
+
}
|
9463
9475
|
return writer;
|
9464
9476
|
},
|
9465
9477
|
decode(input, length) {
|
@@ -9553,6 +9565,12 @@ const SignalRequest = {
|
|
9553
9565
|
updateMetadata: UpdateParticipantMetadata.decode(reader, reader.uint32())
|
9554
9566
|
};
|
9555
9567
|
break;
|
9568
|
+
case 16:
|
9569
|
+
message.message = {
|
9570
|
+
$case: "pingReq",
|
9571
|
+
pingReq: Ping.decode(reader, reader.uint32())
|
9572
|
+
};
|
9573
|
+
break;
|
9556
9574
|
default:
|
9557
9575
|
reader.skipType(tag & 7);
|
9558
9576
|
break;
|
@@ -9604,11 +9622,14 @@ const SignalRequest = {
|
|
9604
9622
|
} : isSet(object.updateMetadata) ? {
|
9605
9623
|
$case: "updateMetadata",
|
9606
9624
|
updateMetadata: UpdateParticipantMetadata.fromJSON(object.updateMetadata)
|
9625
|
+
} : isSet(object.pingReq) ? {
|
9626
|
+
$case: "pingReq",
|
9627
|
+
pingReq: Ping.fromJSON(object.pingReq)
|
9607
9628
|
} : undefined
|
9608
9629
|
};
|
9609
9630
|
},
|
9610
9631
|
toJSON(message) {
|
9611
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
9632
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
9612
9633
|
const obj = {};
|
9613
9634
|
((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer" && (obj.offer = ((_b = message.message) === null || _b === void 0 ? void 0 : _b.offer) ? SessionDescription.toJSON((_c = message.message) === null || _c === void 0 ? void 0 : _c.offer) : undefined);
|
9614
9635
|
((_d = message.message) === null || _d === void 0 ? void 0 : _d.$case) === "answer" && (obj.answer = ((_e = message.message) === null || _e === void 0 ? void 0 : _e.answer) ? SessionDescription.toJSON((_f = message.message) === null || _f === void 0 ? void 0 : _f.answer) : undefined);
|
@@ -9624,10 +9645,11 @@ const SignalRequest = {
|
|
9624
9645
|
((_9 = message.message) === null || _9 === void 0 ? void 0 : _9.$case) === "simulate" && (obj.simulate = ((_10 = message.message) === null || _10 === void 0 ? void 0 : _10.simulate) ? SimulateScenario.toJSON((_11 = message.message) === null || _11 === void 0 ? void 0 : _11.simulate) : undefined);
|
9625
9646
|
((_12 = message.message) === null || _12 === void 0 ? void 0 : _12.$case) === "ping" && (obj.ping = Math.round((_13 = message.message) === null || _13 === void 0 ? void 0 : _13.ping));
|
9626
9647
|
((_14 = message.message) === null || _14 === void 0 ? void 0 : _14.$case) === "updateMetadata" && (obj.updateMetadata = ((_15 = message.message) === null || _15 === void 0 ? void 0 : _15.updateMetadata) ? UpdateParticipantMetadata.toJSON((_16 = message.message) === null || _16 === void 0 ? void 0 : _16.updateMetadata) : undefined);
|
9648
|
+
((_17 = message.message) === null || _17 === void 0 ? void 0 : _17.$case) === "pingReq" && (obj.pingReq = ((_18 = message.message) === null || _18 === void 0 ? void 0 : _18.pingReq) ? Ping.toJSON((_19 = message.message) === null || _19 === void 0 ? void 0 : _19.pingReq) : undefined);
|
9627
9649
|
return obj;
|
9628
9650
|
},
|
9629
9651
|
fromPartial(object) {
|
9630
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
|
9652
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
|
9631
9653
|
const message = createBaseSignalRequest();
|
9632
9654
|
if (((_a = object.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer" && ((_b = object.message) === null || _b === void 0 ? void 0 : _b.offer) !== undefined && ((_c = object.message) === null || _c === void 0 ? void 0 : _c.offer) !== null) {
|
9633
9655
|
message.message = {
|
@@ -9713,6 +9735,12 @@ const SignalRequest = {
|
|
9713
9735
|
updateMetadata: UpdateParticipantMetadata.fromPartial(object.message.updateMetadata)
|
9714
9736
|
};
|
9715
9737
|
}
|
9738
|
+
if (((_18 = object.message) === null || _18 === void 0 ? void 0 : _18.$case) === "pingReq" && ((_19 = object.message) === null || _19 === void 0 ? void 0 : _19.pingReq) !== undefined && ((_20 = object.message) === null || _20 === void 0 ? void 0 : _20.pingReq) !== null) {
|
9739
|
+
message.message = {
|
9740
|
+
$case: "pingReq",
|
9741
|
+
pingReq: Ping.fromPartial(object.message.pingReq)
|
9742
|
+
};
|
9743
|
+
}
|
9716
9744
|
return message;
|
9717
9745
|
}
|
9718
9746
|
};
|
@@ -9724,7 +9752,7 @@ function createBaseSignalResponse() {
|
|
9724
9752
|
const SignalResponse = {
|
9725
9753
|
encode(message) {
|
9726
9754
|
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
|
9727
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
9755
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
9728
9756
|
if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "join") {
|
9729
9757
|
JoinResponse.encode(message.message.join, writer.uint32(10).fork()).ldelim();
|
9730
9758
|
}
|
@@ -9779,6 +9807,9 @@ const SignalResponse = {
|
|
9779
9807
|
if (((_t = message.message) === null || _t === void 0 ? void 0 : _t.$case) === "reconnect") {
|
9780
9808
|
ReconnectResponse.encode(message.message.reconnect, writer.uint32(154).fork()).ldelim();
|
9781
9809
|
}
|
9810
|
+
if (((_u = message.message) === null || _u === void 0 ? void 0 : _u.$case) === "pongResp") {
|
9811
|
+
Pong.encode(message.message.pongResp, writer.uint32(162).fork()).ldelim();
|
9812
|
+
}
|
9782
9813
|
return writer;
|
9783
9814
|
},
|
9784
9815
|
decode(input, length) {
|
@@ -9896,6 +9927,12 @@ const SignalResponse = {
|
|
9896
9927
|
reconnect: ReconnectResponse.decode(reader, reader.uint32())
|
9897
9928
|
};
|
9898
9929
|
break;
|
9930
|
+
case 20:
|
9931
|
+
message.message = {
|
9932
|
+
$case: "pongResp",
|
9933
|
+
pongResp: Pong.decode(reader, reader.uint32())
|
9934
|
+
};
|
9935
|
+
break;
|
9899
9936
|
default:
|
9900
9937
|
reader.skipType(tag & 7);
|
9901
9938
|
break;
|
@@ -9959,11 +9996,14 @@ const SignalResponse = {
|
|
9959
9996
|
} : isSet(object.reconnect) ? {
|
9960
9997
|
$case: "reconnect",
|
9961
9998
|
reconnect: ReconnectResponse.fromJSON(object.reconnect)
|
9999
|
+
} : isSet(object.pongResp) ? {
|
10000
|
+
$case: "pongResp",
|
10001
|
+
pongResp: Pong.fromJSON(object.pongResp)
|
9962
10002
|
} : undefined
|
9963
10003
|
};
|
9964
10004
|
},
|
9965
10005
|
toJSON(message) {
|
9966
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27;
|
10006
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30;
|
9967
10007
|
const obj = {};
|
9968
10008
|
((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "join" && (obj.join = ((_b = message.message) === null || _b === void 0 ? void 0 : _b.join) ? JoinResponse.toJSON((_c = message.message) === null || _c === void 0 ? void 0 : _c.join) : undefined);
|
9969
10009
|
((_d = message.message) === null || _d === void 0 ? void 0 : _d.$case) === "answer" && (obj.answer = ((_e = message.message) === null || _e === void 0 ? void 0 : _e.answer) ? SessionDescription.toJSON((_f = message.message) === null || _f === void 0 ? void 0 : _f.answer) : undefined);
|
@@ -9983,10 +10023,11 @@ const SignalResponse = {
|
|
9983
10023
|
((_20 = message.message) === null || _20 === void 0 ? void 0 : _20.$case) === "trackUnpublished" && (obj.trackUnpublished = ((_21 = message.message) === null || _21 === void 0 ? void 0 : _21.trackUnpublished) ? TrackUnpublishedResponse.toJSON((_22 = message.message) === null || _22 === void 0 ? void 0 : _22.trackUnpublished) : undefined);
|
9984
10024
|
((_23 = message.message) === null || _23 === void 0 ? void 0 : _23.$case) === "pong" && (obj.pong = Math.round((_24 = message.message) === null || _24 === void 0 ? void 0 : _24.pong));
|
9985
10025
|
((_25 = message.message) === null || _25 === void 0 ? void 0 : _25.$case) === "reconnect" && (obj.reconnect = ((_26 = message.message) === null || _26 === void 0 ? void 0 : _26.reconnect) ? ReconnectResponse.toJSON((_27 = message.message) === null || _27 === void 0 ? void 0 : _27.reconnect) : undefined);
|
10026
|
+
((_28 = message.message) === null || _28 === void 0 ? void 0 : _28.$case) === "pongResp" && (obj.pongResp = ((_29 = message.message) === null || _29 === void 0 ? void 0 : _29.pongResp) ? Pong.toJSON((_30 = message.message) === null || _30 === void 0 ? void 0 : _30.pongResp) : undefined);
|
9986
10027
|
return obj;
|
9987
10028
|
},
|
9988
10029
|
fromPartial(object) {
|
9989
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
|
10030
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32;
|
9990
10031
|
const message = createBaseSignalResponse();
|
9991
10032
|
if (((_a = object.message) === null || _a === void 0 ? void 0 : _a.$case) === "join" && ((_b = object.message) === null || _b === void 0 ? void 0 : _b.join) !== undefined && ((_c = object.message) === null || _c === void 0 ? void 0 : _c.join) !== null) {
|
9992
10033
|
message.message = {
|
@@ -10096,6 +10137,12 @@ const SignalResponse = {
|
|
10096
10137
|
reconnect: ReconnectResponse.fromPartial(object.message.reconnect)
|
10097
10138
|
};
|
10098
10139
|
}
|
10140
|
+
if (((_30 = object.message) === null || _30 === void 0 ? void 0 : _30.$case) === "pongResp" && ((_31 = object.message) === null || _31 === void 0 ? void 0 : _31.pongResp) !== undefined && ((_32 = object.message) === null || _32 === void 0 ? void 0 : _32.pongResp) !== null) {
|
10141
|
+
message.message = {
|
10142
|
+
$case: "pongResp",
|
10143
|
+
pongResp: Pong.fromPartial(object.message.pongResp)
|
10144
|
+
};
|
10145
|
+
}
|
10099
10146
|
return message;
|
10100
10147
|
}
|
10101
10148
|
};
|
@@ -10633,7 +10680,10 @@ const JoinResponse = {
|
|
10633
10680
|
function createBaseReconnectResponse() {
|
10634
10681
|
return {
|
10635
10682
|
iceServers: [],
|
10636
|
-
clientConfiguration: undefined
|
10683
|
+
clientConfiguration: undefined,
|
10684
|
+
room: undefined,
|
10685
|
+
participant: undefined,
|
10686
|
+
otherParticipants: []
|
10637
10687
|
};
|
10638
10688
|
}
|
10639
10689
|
const ReconnectResponse = {
|
@@ -10645,6 +10695,15 @@ const ReconnectResponse = {
|
|
10645
10695
|
if (message.clientConfiguration !== undefined) {
|
10646
10696
|
ClientConfiguration.encode(message.clientConfiguration, writer.uint32(18).fork()).ldelim();
|
10647
10697
|
}
|
10698
|
+
if (message.room !== undefined) {
|
10699
|
+
Room$1.encode(message.room, writer.uint32(26).fork()).ldelim();
|
10700
|
+
}
|
10701
|
+
if (message.participant !== undefined) {
|
10702
|
+
ParticipantInfo.encode(message.participant, writer.uint32(34).fork()).ldelim();
|
10703
|
+
}
|
10704
|
+
for (const v of message.otherParticipants) {
|
10705
|
+
ParticipantInfo.encode(v, writer.uint32(42).fork()).ldelim();
|
10706
|
+
}
|
10648
10707
|
return writer;
|
10649
10708
|
},
|
10650
10709
|
decode(input, length) {
|
@@ -10660,6 +10719,15 @@ const ReconnectResponse = {
|
|
10660
10719
|
case 2:
|
10661
10720
|
message.clientConfiguration = ClientConfiguration.decode(reader, reader.uint32());
|
10662
10721
|
break;
|
10722
|
+
case 3:
|
10723
|
+
message.room = Room$1.decode(reader, reader.uint32());
|
10724
|
+
break;
|
10725
|
+
case 4:
|
10726
|
+
message.participant = ParticipantInfo.decode(reader, reader.uint32());
|
10727
|
+
break;
|
10728
|
+
case 5:
|
10729
|
+
message.otherParticipants.push(ParticipantInfo.decode(reader, reader.uint32()));
|
10730
|
+
break;
|
10663
10731
|
default:
|
10664
10732
|
reader.skipType(tag & 7);
|
10665
10733
|
break;
|
@@ -10670,7 +10738,10 @@ const ReconnectResponse = {
|
|
10670
10738
|
fromJSON(object) {
|
10671
10739
|
return {
|
10672
10740
|
iceServers: Array.isArray(object === null || object === void 0 ? void 0 : object.iceServers) ? object.iceServers.map(e => ICEServer.fromJSON(e)) : [],
|
10673
|
-
clientConfiguration: isSet(object.clientConfiguration) ? ClientConfiguration.fromJSON(object.clientConfiguration) : undefined
|
10741
|
+
clientConfiguration: isSet(object.clientConfiguration) ? ClientConfiguration.fromJSON(object.clientConfiguration) : undefined,
|
10742
|
+
room: isSet(object.room) ? Room$1.fromJSON(object.room) : undefined,
|
10743
|
+
participant: isSet(object.participant) ? ParticipantInfo.fromJSON(object.participant) : undefined,
|
10744
|
+
otherParticipants: Array.isArray(object === null || object === void 0 ? void 0 : object.otherParticipants) ? object.otherParticipants.map(e => ParticipantInfo.fromJSON(e)) : []
|
10674
10745
|
};
|
10675
10746
|
},
|
10676
10747
|
toJSON(message) {
|
@@ -10681,13 +10752,23 @@ const ReconnectResponse = {
|
|
10681
10752
|
obj.iceServers = [];
|
10682
10753
|
}
|
10683
10754
|
message.clientConfiguration !== undefined && (obj.clientConfiguration = message.clientConfiguration ? ClientConfiguration.toJSON(message.clientConfiguration) : undefined);
|
10755
|
+
message.room !== undefined && (obj.room = message.room ? Room$1.toJSON(message.room) : undefined);
|
10756
|
+
message.participant !== undefined && (obj.participant = message.participant ? ParticipantInfo.toJSON(message.participant) : undefined);
|
10757
|
+
if (message.otherParticipants) {
|
10758
|
+
obj.otherParticipants = message.otherParticipants.map(e => e ? ParticipantInfo.toJSON(e) : undefined);
|
10759
|
+
} else {
|
10760
|
+
obj.otherParticipants = [];
|
10761
|
+
}
|
10684
10762
|
return obj;
|
10685
10763
|
},
|
10686
10764
|
fromPartial(object) {
|
10687
|
-
var _a;
|
10765
|
+
var _a, _b;
|
10688
10766
|
const message = createBaseReconnectResponse();
|
10689
10767
|
message.iceServers = ((_a = object.iceServers) === null || _a === void 0 ? void 0 : _a.map(e => ICEServer.fromPartial(e))) || [];
|
10690
10768
|
message.clientConfiguration = object.clientConfiguration !== undefined && object.clientConfiguration !== null ? ClientConfiguration.fromPartial(object.clientConfiguration) : undefined;
|
10769
|
+
message.room = object.room !== undefined && object.room !== null ? Room$1.fromPartial(object.room) : undefined;
|
10770
|
+
message.participant = object.participant !== undefined && object.participant !== null ? ParticipantInfo.fromPartial(object.participant) : undefined;
|
10771
|
+
message.otherParticipants = ((_b = object.otherParticipants) === null || _b === void 0 ? void 0 : _b.map(e => ParticipantInfo.fromPartial(e))) || [];
|
10691
10772
|
return message;
|
10692
10773
|
}
|
10693
10774
|
};
|
@@ -12358,6 +12439,120 @@ const SimulateScenario = {
|
|
12358
12439
|
return message;
|
12359
12440
|
}
|
12360
12441
|
};
|
12442
|
+
function createBasePing() {
|
12443
|
+
return {
|
12444
|
+
timestamp: 0,
|
12445
|
+
rtt: 0
|
12446
|
+
};
|
12447
|
+
}
|
12448
|
+
const Ping = {
|
12449
|
+
encode(message) {
|
12450
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
|
12451
|
+
if (message.timestamp !== 0) {
|
12452
|
+
writer.uint32(8).int64(message.timestamp);
|
12453
|
+
}
|
12454
|
+
if (message.rtt !== 0) {
|
12455
|
+
writer.uint32(16).int64(message.rtt);
|
12456
|
+
}
|
12457
|
+
return writer;
|
12458
|
+
},
|
12459
|
+
decode(input, length) {
|
12460
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
12461
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
12462
|
+
const message = createBasePing();
|
12463
|
+
while (reader.pos < end) {
|
12464
|
+
const tag = reader.uint32();
|
12465
|
+
switch (tag >>> 3) {
|
12466
|
+
case 1:
|
12467
|
+
message.timestamp = longToNumber(reader.int64());
|
12468
|
+
break;
|
12469
|
+
case 2:
|
12470
|
+
message.rtt = longToNumber(reader.int64());
|
12471
|
+
break;
|
12472
|
+
default:
|
12473
|
+
reader.skipType(tag & 7);
|
12474
|
+
break;
|
12475
|
+
}
|
12476
|
+
}
|
12477
|
+
return message;
|
12478
|
+
},
|
12479
|
+
fromJSON(object) {
|
12480
|
+
return {
|
12481
|
+
timestamp: isSet(object.timestamp) ? Number(object.timestamp) : 0,
|
12482
|
+
rtt: isSet(object.rtt) ? Number(object.rtt) : 0
|
12483
|
+
};
|
12484
|
+
},
|
12485
|
+
toJSON(message) {
|
12486
|
+
const obj = {};
|
12487
|
+
message.timestamp !== undefined && (obj.timestamp = Math.round(message.timestamp));
|
12488
|
+
message.rtt !== undefined && (obj.rtt = Math.round(message.rtt));
|
12489
|
+
return obj;
|
12490
|
+
},
|
12491
|
+
fromPartial(object) {
|
12492
|
+
var _a, _b;
|
12493
|
+
const message = createBasePing();
|
12494
|
+
message.timestamp = (_a = object.timestamp) !== null && _a !== void 0 ? _a : 0;
|
12495
|
+
message.rtt = (_b = object.rtt) !== null && _b !== void 0 ? _b : 0;
|
12496
|
+
return message;
|
12497
|
+
}
|
12498
|
+
};
|
12499
|
+
function createBasePong() {
|
12500
|
+
return {
|
12501
|
+
lastPingTimestamp: 0,
|
12502
|
+
timestamp: 0
|
12503
|
+
};
|
12504
|
+
}
|
12505
|
+
const Pong = {
|
12506
|
+
encode(message) {
|
12507
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
|
12508
|
+
if (message.lastPingTimestamp !== 0) {
|
12509
|
+
writer.uint32(8).int64(message.lastPingTimestamp);
|
12510
|
+
}
|
12511
|
+
if (message.timestamp !== 0) {
|
12512
|
+
writer.uint32(16).int64(message.timestamp);
|
12513
|
+
}
|
12514
|
+
return writer;
|
12515
|
+
},
|
12516
|
+
decode(input, length) {
|
12517
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
12518
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
12519
|
+
const message = createBasePong();
|
12520
|
+
while (reader.pos < end) {
|
12521
|
+
const tag = reader.uint32();
|
12522
|
+
switch (tag >>> 3) {
|
12523
|
+
case 1:
|
12524
|
+
message.lastPingTimestamp = longToNumber(reader.int64());
|
12525
|
+
break;
|
12526
|
+
case 2:
|
12527
|
+
message.timestamp = longToNumber(reader.int64());
|
12528
|
+
break;
|
12529
|
+
default:
|
12530
|
+
reader.skipType(tag & 7);
|
12531
|
+
break;
|
12532
|
+
}
|
12533
|
+
}
|
12534
|
+
return message;
|
12535
|
+
},
|
12536
|
+
fromJSON(object) {
|
12537
|
+
return {
|
12538
|
+
lastPingTimestamp: isSet(object.lastPingTimestamp) ? Number(object.lastPingTimestamp) : 0,
|
12539
|
+
timestamp: isSet(object.timestamp) ? Number(object.timestamp) : 0
|
12540
|
+
};
|
12541
|
+
},
|
12542
|
+
toJSON(message) {
|
12543
|
+
const obj = {};
|
12544
|
+
message.lastPingTimestamp !== undefined && (obj.lastPingTimestamp = Math.round(message.lastPingTimestamp));
|
12545
|
+
message.timestamp !== undefined && (obj.timestamp = Math.round(message.timestamp));
|
12546
|
+
return obj;
|
12547
|
+
},
|
12548
|
+
fromPartial(object) {
|
12549
|
+
var _a, _b;
|
12550
|
+
const message = createBasePong();
|
12551
|
+
message.lastPingTimestamp = (_a = object.lastPingTimestamp) !== null && _a !== void 0 ? _a : 0;
|
12552
|
+
message.timestamp = (_b = object.timestamp) !== null && _b !== void 0 ? _b : 0;
|
12553
|
+
return message;
|
12554
|
+
}
|
12555
|
+
};
|
12361
12556
|
var tsProtoGlobalThis = (() => {
|
12362
12557
|
if (typeof globalThis !== "undefined") {
|
12363
12558
|
return globalThis;
|
@@ -13604,7 +13799,7 @@ var uaParser = {
|
|
13604
13799
|
})(uaParser, uaParserExports);
|
13605
13800
|
var UAParser = uaParserExports;
|
13606
13801
|
|
13607
|
-
var version$1 = "1.6.
|
13802
|
+
var version$1 = "1.6.5";
|
13608
13803
|
|
13609
13804
|
const version = version$1;
|
13610
13805
|
const protocolVersion = 8;
|
@@ -15160,7 +15355,7 @@ class LocalAudioTrack extends LocalTrack {
|
|
15160
15355
|
}
|
15161
15356
|
async unmute() {
|
15162
15357
|
await this.muteQueue.run(async () => {
|
15163
|
-
if (this.source === Track.Source.Microphone && this.stopOnMute && !this.isUserProvided) {
|
15358
|
+
if (this.source === Track.Source.Microphone && (this.stopOnMute || this._mediaStreamTrack.readyState === 'ended') && !this.isUserProvided) {
|
15164
15359
|
livekitLogger.debug('reacquiring mic track');
|
15165
15360
|
await this.restartTrack();
|
15166
15361
|
}
|
@@ -17429,7 +17624,9 @@ class LocalParticipant extends Participant {
|
|
17429
17624
|
// detect granted change after permissions were denied to try and resume then
|
17430
17625
|
currentPermissions.onchange = () => {
|
17431
17626
|
if (currentPermissions.state !== 'denied') {
|
17432
|
-
track.
|
17627
|
+
if (!track.isMuted) {
|
17628
|
+
track.restartTrack();
|
17629
|
+
}
|
17433
17630
|
currentPermissions.onchange = null;
|
17434
17631
|
}
|
17435
17632
|
};
|
@@ -17439,8 +17636,10 @@ class LocalParticipant extends Participant {
|
|
17439
17636
|
// permissions query fails for firefox, we continue and try to restart the track
|
17440
17637
|
}
|
17441
17638
|
}
|
17442
|
-
|
17443
|
-
|
17639
|
+
if (!track.isMuted) {
|
17640
|
+
livekitLogger.debug('track ended, attempting to use a different device');
|
17641
|
+
await track.restartTrack();
|
17642
|
+
}
|
17444
17643
|
} catch (e) {
|
17445
17644
|
livekitLogger.warn("could not restart track, muting instead");
|
17446
17645
|
await track.mute();
|
@@ -18176,6 +18375,8 @@ function canPassThroughQueue(req) {
|
|
18176
18375
|
class SignalClient {
|
18177
18376
|
constructor() {
|
18178
18377
|
let useJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
18378
|
+
/** signal rtt in milliseconds */
|
18379
|
+
this.rtt = 0;
|
18179
18380
|
this.isConnected = false;
|
18180
18381
|
this.isReconnecting = false;
|
18181
18382
|
this.useJSON = useJSON;
|
@@ -18191,7 +18392,7 @@ class SignalClient {
|
|
18191
18392
|
const res = await this.connect(url, token, opts, abortSignal);
|
18192
18393
|
return res;
|
18193
18394
|
}
|
18194
|
-
async reconnect(url, token, sid) {
|
18395
|
+
async reconnect(url, token, sid, reason) {
|
18195
18396
|
if (!this.options) {
|
18196
18397
|
livekitLogger.warn('attempted to reconnect without signal options being set, ignoring');
|
18197
18398
|
return;
|
@@ -18201,7 +18402,8 @@ class SignalClient {
|
|
18201
18402
|
this.clearPingInterval();
|
18202
18403
|
const res = await this.connect(url, token, _objectSpread2(_objectSpread2({}, this.options), {}, {
|
18203
18404
|
reconnect: true,
|
18204
|
-
sid
|
18405
|
+
sid,
|
18406
|
+
reconnectReason: reason
|
18205
18407
|
}));
|
18206
18408
|
return res;
|
18207
18409
|
}
|
@@ -18423,10 +18625,18 @@ class SignalClient {
|
|
18423
18625
|
});
|
18424
18626
|
}
|
18425
18627
|
sendPing() {
|
18628
|
+
/** send both of ping and pingReq for compatibility to old and new server */
|
18426
18629
|
this.sendRequest({
|
18427
18630
|
$case: 'ping',
|
18428
18631
|
ping: Date.now()
|
18429
18632
|
});
|
18633
|
+
this.sendRequest({
|
18634
|
+
$case: 'pingReq',
|
18635
|
+
pingReq: {
|
18636
|
+
timestamp: Date.now(),
|
18637
|
+
rtt: this.rtt
|
18638
|
+
}
|
18639
|
+
});
|
18430
18640
|
}
|
18431
18641
|
async sendLeave() {
|
18432
18642
|
await this.sendRequest({
|
@@ -18546,6 +18756,9 @@ class SignalClient {
|
|
18546
18756
|
}
|
18547
18757
|
} else if (msg.$case === 'pong') {
|
18548
18758
|
this.resetPingTimeout();
|
18759
|
+
} else if (msg.$case === 'pongResp') {
|
18760
|
+
this.rtt = Date.now() - msg.pongResp.lastPingTimestamp;
|
18761
|
+
this.resetPingTimeout();
|
18549
18762
|
} else {
|
18550
18763
|
livekitLogger.debug('unsupported message', msg);
|
18551
18764
|
}
|
@@ -18562,6 +18775,10 @@ class SignalClient {
|
|
18562
18775
|
handleWSError(ev) {
|
18563
18776
|
livekitLogger.error('websocket error', ev);
|
18564
18777
|
}
|
18778
|
+
/**
|
18779
|
+
* Resets the ping timeout and starts a new timeout.
|
18780
|
+
* Call this after receiving a pong message
|
18781
|
+
*/
|
18565
18782
|
resetPingTimeout() {
|
18566
18783
|
this.clearPingTimeout();
|
18567
18784
|
if (!this.pingTimeoutDuration) {
|
@@ -18575,6 +18792,9 @@ class SignalClient {
|
|
18575
18792
|
}
|
18576
18793
|
}, this.pingTimeoutDuration * 1000);
|
18577
18794
|
}
|
18795
|
+
/**
|
18796
|
+
* Clears ping timeout (does not start a new timeout)
|
18797
|
+
*/
|
18578
18798
|
clearPingTimeout() {
|
18579
18799
|
if (this.pingTimeout) {
|
18580
18800
|
CriticalTimers.clearTimeout(this.pingTimeout);
|
@@ -18659,6 +18879,9 @@ function createConnectionParams(token, info, opts) {
|
|
18659
18879
|
if (opts.adaptiveStream) {
|
18660
18880
|
params.set('adaptive_stream', '1');
|
18661
18881
|
}
|
18882
|
+
if (opts.reconnectReason) {
|
18883
|
+
params.set('reconnect_reason', opts.reconnectReason.toString());
|
18884
|
+
}
|
18662
18885
|
// @ts-ignore
|
18663
18886
|
if ((_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.type) {
|
18664
18887
|
// @ts-ignore
|
@@ -19720,6 +19943,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
19720
19943
|
// after a number of retries, we'll close and give up permanently
|
19721
19944
|
this.handleDisconnect = function (connection) {
|
19722
19945
|
let signalEvents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
19946
|
+
let disconnectReason = arguments.length > 2 ? arguments[2] : undefined;
|
19723
19947
|
if (_this._isClosed) {
|
19724
19948
|
return;
|
19725
19949
|
}
|
@@ -19747,13 +19971,13 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
19747
19971
|
}
|
19748
19972
|
livekitLogger.debug("reconnecting in ".concat(delay, "ms"));
|
19749
19973
|
_this.clearReconnectTimeout();
|
19750
|
-
_this.reconnectTimeout = CriticalTimers.setTimeout(() => _this.attemptReconnect(signalEvents), delay);
|
19974
|
+
_this.reconnectTimeout = CriticalTimers.setTimeout(() => _this.attemptReconnect(signalEvents, disconnectReason), delay);
|
19751
19975
|
};
|
19752
19976
|
this.handleBrowserOnLine = () => {
|
19753
19977
|
// in case the engine is currently reconnecting, attempt a reconnect immediately after the browser state has changed to 'onLine'
|
19754
19978
|
if (this.client.isReconnecting) {
|
19755
19979
|
this.clearReconnectTimeout();
|
19756
|
-
this.attemptReconnect(true);
|
19980
|
+
this.attemptReconnect(true, ReconnectReason.REASON_SIGNAL_DISCONNECTED);
|
19757
19981
|
}
|
19758
19982
|
};
|
19759
19983
|
this.client = new SignalClient();
|
@@ -19907,7 +20131,8 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
19907
20131
|
};
|
19908
20132
|
let primaryPC = this.publisher.pc;
|
19909
20133
|
let secondaryPC = this.subscriber.pc;
|
19910
|
-
|
20134
|
+
let subscriberPrimary = joinResponse.subscriberPrimary;
|
20135
|
+
if (subscriberPrimary) {
|
19911
20136
|
primaryPC = this.subscriber.pc;
|
19912
20137
|
secondaryPC = this.publisher.pc;
|
19913
20138
|
// in subscriber primary mode, server side opens sub data channels.
|
@@ -19933,7 +20158,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
19933
20158
|
// on Safari, PeerConnection will switch to 'disconnected' during renegotiation
|
19934
20159
|
if (this.pcState === PCState.Connected) {
|
19935
20160
|
this.pcState = PCState.Disconnected;
|
19936
|
-
this.handleDisconnect('primary peerconnection');
|
20161
|
+
this.handleDisconnect('primary peerconnection', false, subscriberPrimary ? ReconnectReason.REASON_SUBSCRIBER_FAILED : ReconnectReason.REASON_PUBLISHER_FAILED);
|
19937
20162
|
}
|
19938
20163
|
}
|
19939
20164
|
};
|
@@ -19941,7 +20166,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
19941
20166
|
livekitLogger.debug("secondary PC state changed ".concat(secondaryPC.connectionState));
|
19942
20167
|
// also reconnect if secondary peerconnection fails
|
19943
20168
|
if (secondaryPC.connectionState === 'failed') {
|
19944
|
-
this.handleDisconnect('secondary peerconnection');
|
20169
|
+
this.handleDisconnect('secondary peerconnection', false, subscriberPrimary ? ReconnectReason.REASON_PUBLISHER_FAILED : ReconnectReason.REASON_SUBSCRIBER_FAILED);
|
19945
20170
|
}
|
19946
20171
|
};
|
19947
20172
|
this.subscriber.pc.ontrack = ev => {
|
@@ -20004,7 +20229,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20004
20229
|
this.token = token;
|
20005
20230
|
};
|
20006
20231
|
this.client.onClose = () => {
|
20007
|
-
this.handleDisconnect('signal');
|
20232
|
+
this.handleDisconnect('signal', false, ReconnectReason.REASON_SIGNAL_DISCONNECTED);
|
20008
20233
|
};
|
20009
20234
|
this.client.onLeave = leave => {
|
20010
20235
|
if (leave === null || leave === void 0 ? void 0 : leave.canReconnect) {
|
@@ -20180,6 +20405,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20180
20405
|
}
|
20181
20406
|
async attemptReconnect() {
|
20182
20407
|
let signalEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
20408
|
+
let reason = arguments.length > 1 ? arguments[1] : undefined;
|
20183
20409
|
var _a, _b, _c;
|
20184
20410
|
if (this._isClosed) {
|
20185
20411
|
return;
|
@@ -20199,7 +20425,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20199
20425
|
if (this.fullReconnectOnNext) {
|
20200
20426
|
await this.restartConnection(signalEvents);
|
20201
20427
|
} else {
|
20202
|
-
await this.resumeConnection(signalEvents);
|
20428
|
+
await this.resumeConnection(signalEvents, reason);
|
20203
20429
|
}
|
20204
20430
|
this.clearPendingReconnect();
|
20205
20431
|
this.fullReconnectOnNext = false;
|
@@ -20225,7 +20451,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20225
20451
|
requireSignalEvents = true;
|
20226
20452
|
}
|
20227
20453
|
if (recoverable) {
|
20228
|
-
this.handleDisconnect('reconnect', requireSignalEvents);
|
20454
|
+
this.handleDisconnect('reconnect', requireSignalEvents, ReconnectReason.REASON_UNKOWN);
|
20229
20455
|
} else {
|
20230
20456
|
livekitLogger.info("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(Date.now() - this.reconnectStart, "ms. giving up"));
|
20231
20457
|
this.emit(EngineEvent.Disconnected);
|
@@ -20283,6 +20509,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20283
20509
|
}
|
20284
20510
|
async resumeConnection() {
|
20285
20511
|
let emitResuming = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
20512
|
+
let reason = arguments.length > 1 ? arguments[1] : undefined;
|
20286
20513
|
var _a;
|
20287
20514
|
if (!this.url || !this.token) {
|
20288
20515
|
// permanent failure, don't attempt reconnection
|
@@ -20297,7 +20524,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20297
20524
|
this.emit(EngineEvent.Resuming);
|
20298
20525
|
}
|
20299
20526
|
try {
|
20300
|
-
const res = await this.client.reconnect(this.url, this.token, this.participantSid);
|
20527
|
+
const res = await this.client.reconnect(this.url, this.token, this.participantSid, reason);
|
20301
20528
|
if (res) {
|
20302
20529
|
const rtcConfig = this.makeRTCConfiguration(res);
|
20303
20530
|
this.publisher.pc.setConfiguration(rtcConfig);
|
@@ -20422,7 +20649,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20422
20649
|
this.on(EngineEvent.Closing, handleClosed);
|
20423
20650
|
const negotiationTimeout = setTimeout(() => {
|
20424
20651
|
reject('negotiation timed out');
|
20425
|
-
this.handleDisconnect('negotiation');
|
20652
|
+
this.handleDisconnect('negotiation', false, ReconnectReason.REASON_SIGNAL_DISCONNECTED);
|
20426
20653
|
}, this.peerConnectionTimeout);
|
20427
20654
|
const cleanup = () => {
|
20428
20655
|
clearTimeout(negotiationTimeout);
|
@@ -20441,7 +20668,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
20441
20668
|
if (e instanceof NegotiationError) {
|
20442
20669
|
this.fullReconnectOnNext = true;
|
20443
20670
|
}
|
20444
|
-
this.handleDisconnect('negotiation');
|
20671
|
+
this.handleDisconnect('negotiation', false, ReconnectReason.REASON_UNKOWN);
|
20445
20672
|
});
|
20446
20673
|
});
|
20447
20674
|
}
|
@@ -20648,14 +20875,18 @@ class Room extends eventsExports.EventEmitter {
|
|
20648
20875
|
} catch (err) {
|
20649
20876
|
this.recreateEngine();
|
20650
20877
|
this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
|
20651
|
-
|
20878
|
+
const resultingError = new ConnectionError("could not establish signal connection");
|
20652
20879
|
if (err instanceof Error) {
|
20653
|
-
|
20654
|
-
livekitLogger.debug("error trying to establish signal connection", {
|
20655
|
-
error: err
|
20656
|
-
});
|
20880
|
+
resultingError.message = "".concat(resultingError.message, ": ").concat(err.message);
|
20657
20881
|
}
|
20658
|
-
|
20882
|
+
if (err instanceof ConnectionError) {
|
20883
|
+
resultingError.reason = err.reason;
|
20884
|
+
resultingError.status = err.status;
|
20885
|
+
}
|
20886
|
+
livekitLogger.debug("error trying to establish signal connection", {
|
20887
|
+
error: err
|
20888
|
+
});
|
20889
|
+
reject(resultingError);
|
20659
20890
|
return;
|
20660
20891
|
}
|
20661
20892
|
// don't return until ICE connected
|