shinyoshiaki / werift-webrtc

WebRTC Implementation for TypeScript (Node.js), includes ICE/DTLS/SCTP/RTP/SRTP/WEBM/MP4
MIT License
486 stars 32 forks source link

iceGatheringStateChange is never triggered. #400

Open 0wwafa opened 2 months ago

0wwafa commented 2 months ago
pc1.addEventListener('iceGatheringStateChange', () => {
    if (pc1.iceGatheringState === 'complete') {
        console.log('ICE gathering complete for pc1');
        console.log('SDP:', pc1.localDescription.sdp);
    }
});

pc1.onicegatheringstatechange = () => {
    console.log('changed',pc1.localDescription.sdp);
    if (pc1.iceGatheringState === 'complete') {
        console.log('ICE gathering complete for pc1');
        console.log('SDP:', pc1.localDescription.sdp);
    }
};

both these functions are never triggered. Also, at the end of the ice gathering (and during) sdp should contain all the ice candidates gathered.

This works in a browser. Does not work with werift.

The purpose: I want to instantiate a datachannel. At the end of the ice gathering I want to create the offer with all the candidates inside the sdp. From a web browser I can do that. So after that I send the full offer, I get the full answer and the connection starts.

So in the end is only:

pc1 (create full offer) >> send offer to pc2. pc2 (create full answer) >> send answer to pc1 pc1: connect.

shinyoshiaki commented 2 months ago

I'm not sure of the situation where the iceGatheringStateChange event is not firing in werift, please write a reproduction code.