- From: AhmedKaram via GitHub <sysbot+gh@w3.org>
- Date: Sun, 11 Dec 2022 06:31:27 +0000
- To: public-webrtc-logs@w3.org
Adamkaram has just created a new issue for https://github.com/w3c/webrtc-pc: == need more clarifying? about example in MDN WebRTC perfect negotiation pattern == here i belive they miss something unless i do what they recommended to do in new api to do that ``` let handleRenegotiation = async (description) => { try { if (description) { const offerCollision = description.type == "offer" && (makingOffer || yourConn.signalingState != "stable"); ignoreOffer = !polite && offerCollision; if (ignoreOffer) { return; } yourConn.setRemoteDescription(description) if (description.type == "offer") { await yourConn.setLocalDescription(); wbsc.emit("SEND_EVENT_EMIT_CALL_AUDIO", { data: { type: "answer", answer: yourConn.localDescription, id: connectedUser }, }); } } }catch (e) { console.log(e); } } ``` i believe this could work if i'm impolite peer what if i'm polite peer how to do it should i split the conditions there to check who am i specifically ? as in [here](https://github.com/w3c/webrtc-pc/issues/2167#issuecomment-499475161) or similar to or how i can access 2 peersConnection without clarify that yourConn = new RTCPeerConnection(config); yourConn2 = new RTCPeerConnection(config); can i use 1 object in this case for both connection to work for both end points in generaly without yourConn and yourConn2? or i missed the configuration of onnegotiationneeded ? also is this how i can implement onnegotiationneeded ob both side ``` yourConn.onnegotiationneeded = async () => { console.warn("yourConn.onnegotiationneeded"); try { makingOffer = true; await yourConn.setLocalDescription(); wbsc.emit("SEND_EVENT_EMIT_CALL_AUDIO", { data: { type: "negotiation", description: yourConn.localDescription, id: connectedUser, }, }); } catch (e) { console.log("renegotiationneded fail is ", e); } finally { makingOffer = false; } }; yourConn2.onnegotiationneeded = async () => { console.warn("yourConn2.onnegotiationneeded"); const offer = await yourConn2.createOffer(); try { makingOffer = true; await yourConn2.setLocalDescription(); wbsc.emit("SEND_EVENT_EMIT_CALL_AUDIO", { data: { type: "negotiation", description: yourConn2.localDescription, id: connectedUser }, }) } catch (e) {console.log("renegotiationneded fail is ",e) } finally { makingOffer = false } } ``` if so how in `handleRenegotiation ()` i accept description with `yourConn.setRemoteDescription(description)` that rollback my offer and then create answer and send it to the remote peer as i'm the one how sent the offer what i did here is wrong and should be fix? also onnegotiationneeded fires when or where? as i guees i as a polite peer do iceRestart() -> onnegotiationneeded (sending localdesscription ) to handleRenegotiation () pass ignoreOffer guard in await yourConn.setLocalDescription(); does it rollback my existing offer or what should it do? after that what happend with onnegotiationneeded does i throw to next step or webrtc will re run onnegotiationneeded again ? and within it what happend to my sdp and icecandidate if that the logic i should stick with as they recomended who restart ice first and making the other peer restart his ice secondly Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2806 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 11 December 2022 06:31:29 UTC