From a4b528e1e73e5f63a096095717c4b77d19dcc381 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Wed, 26 Aug 2020 18:30:29 +0200 Subject: [PATCH] Implement onnegotiationcompleted callback. --- static/protocol.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/static/protocol.js b/static/protocol.js index 7e3eeca..a6882f3 100644 --- a/static/protocol.js +++ b/static/protocol.js @@ -533,6 +533,8 @@ ServerConnection.prototype.gotOffer = async function(id, labels, offer, renegoti id: id, answer: answer, }); + if(c.onnegotiationcompleted) + c.onnegotiationcompleted.call(c); } /** @@ -570,6 +572,8 @@ ServerConnection.prototype.gotAnswer = async function(id, answer) { return; } await c.flushIceCandidates(); + if(c.onnegotiationcompleted) + c.onnegotiationcompleted.call(c); } /** @@ -739,6 +743,13 @@ function Stream(sc, id, pc) { * @type{function(any): any} */ this.onerror = null; + /** + * onnegotiationcompleted is called whenever negotiation or + * renegotiation has completed. + * + * @type{function(): any} + */ + this.onnegotiationcompleted = null; /** * ondowntrack is called whenever a new track is added to a stream. * If the stream parameter differs from its previous value, then it