mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
Add support for trickle ice (#193)
* cherry-pick trickle-ice * Add code * Add code * format
This commit is contained in:
@@ -17747,16 +17747,13 @@ function R6(n, e, t = () => {
|
||||
}
|
||||
async function L6(n, e, t, r = () => {
|
||||
}) {
|
||||
return n.createOffer().then((a) => n.setLocalDescription(a)).then(() => new Promise((a) => {
|
||||
if (console.debug("ice gathering state", n.iceGatheringState), n.iceGatheringState === "complete")
|
||||
a();
|
||||
else {
|
||||
const i = () => {
|
||||
n.iceGatheringState === "complete" && (console.debug("ice complete"), n.removeEventListener("icegatheringstatechange", i), a());
|
||||
};
|
||||
n.addEventListener("icegatheringstatechange", i);
|
||||
}
|
||||
})).then(() => {
|
||||
return n.onicecandidate = ({ candidate: a }) => {
|
||||
a && (console.debug("Sending ICE candidate", a), e({
|
||||
candidate: a.toJSON(),
|
||||
webrtc_id: t,
|
||||
type: "ice-candidate"
|
||||
}).catch((i) => console.error("Error sending ICE candidate:", i)));
|
||||
}, n.createOffer().then((a) => n.setLocalDescription(a)).then(() => {
|
||||
var a = n.localDescription;
|
||||
return R6(
|
||||
e,
|
||||
|
||||
Reference in New Issue
Block a user