GithubHelp home page GithubHelp logo

Comments (6)

CharlieHollow avatar CharlieHollow commented on May 17, 2024

Finally, I've found out the problem. AioRTC does not use "addCandidates" or "sendCandidates", it only uses "createOffer", "createAnswer", "setLocalDescription" and "setRemoteDescription", so candidates MUST be included in offers/answers. My problem was browser offer and aiortc peer answer did not include candidates.

To solve it, I had to create offer/answer again after browser starts sending ice candidates and ice candidate status changed to "checking".

Something like this:

    localPeer.oniceconnectionstatechange = function(event) {
	 trace("ICE Candidate State: " + localPeer.iceConnectionState);
	 trace("ICE Gathering State: " + localPeer.iceGatheringState);

	// Create offer again and send it to remote peer with new candidates
	if(localPeer.iceConnectionState == "checking") {
		console.log("It is checking right now");
		localPeer.createOffer(offerOptions).then(
			function(offer) {
				//console.log('New offer created: ' + JSON.stringify(offer))
				localPeer.setLocalDescription(offer);
				sendNegotiation("offer", offer);
			},
			function(err) {
				console.log('Error creating new offer');
			}
		);
	}
};

In addition, I had to add to "rtcicetransport.py" RTCIceGatherer initializer a turn server to solve NAT issues.

from aiortc.

jlaine avatar jlaine commented on May 17, 2024

Hi Charlie, indeed this is documented in the README : ICE Trickle isn't yet supported.

I plan to eventually I'd like to add support for this, the initial step being to add support for ICE trickle to aioice:
https://github.com/jlaine/aioice/issues/4

from aiortc.

CharlieHollow avatar CharlieHollow commented on May 17, 2024

Hi @jlaine,

Its true, you documented it in the README, but it was not clear enough for me. This is why I've tried to connect both peers, making some tricks.

Anyway, any support for ICE trickle is appreciated. Hope you could update it soon.

Thanks so much.

In addition, a modification in RTCPeerConnection constructor to support adding custom STUN and TURN servers will be appreciated as well, as it is reflected in this issue: jlaine/aiortc#13

from aiortc.

tartavull avatar tartavull commented on May 17, 2024

I believe I'm running onto the same issue. Is there any way to disable ICE Trickle on the browser?

from aiortc.

tartavull avatar tartavull commented on May 17, 2024

iceCandidatePoolSize does prefetching of ICE candidates avoiding sending an offer with no candidates

var pc = new RTCPeerConnection({
    sdpSemantics: 'unified-plan', //newer implementation of WebRTC
    iceServers: [{urls: 'stun:stun.l.google.com:19302'}],
    iceCandidatePoolSize: 2
});

from aiortc.

XingkaiEden avatar XingkaiEden commented on May 17, 2024

I got the same issue. Because my project was originally written in JS which has a listener for ice candidates and then call back WebSocket to send it.

now, I have to change the plan.

Your solution really inspire me, thanks

from aiortc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.