Closed maurosorrentino closed 7 months ago
Before you create the offer, you must first specify media involved in the connection / call. (I guess you did it) You create the offer and set it as local description.
The offer must contains one or several lines starting with "m=". Is it the case ?
This offer must be be provided to the peer. The peer could specify which media are involved in the connection / call (for example he wants to receive only audio - not send/receive). Then use the offer using setRemoteDescription. Finally call createanswer to have the 'final' SDP.
Here you must have one or several lines starting with "m=". Is it the case ?
Send it to back to first emitter which must use it using setRemoteDescription.
adding the audio worked! I didn't think I needed that as I will use webRTC for peer to peer connection but clients will exchange strings and not audio or video. Many thanks, I appreciate it a lot as I was stuck for a while
If you want a DataChannel only, specify it before to create the first offer. (like any other media) I guess your pb is solved
I create the offer like this
RTCSessionDescriptionInit offer = this.peerConnection.createOffer(null);
I set the local description like thisawait this.peerConnection.setLocalDescription(offer);
via my signaling mechanism I get the offer and set the remote description like thisthis.peerConnection.setRemoteDescription(offer); // offer is of type RTCSessionDescriptionInit
I create the answer like thisRTCSessionDescriptionInit answer = this.peerConnection.createAnswer(null);
I set the local description like thisawait this.peerConnection.setLocalDescription(answer);
I send the answer via my signaling mechanism and set the remote description like thisthis.peerConnection.setRemoteDescription(answer); // answer is of type RTCSessionDescriptionInit
RTCPeerConnection minimal implementation is this one
RTCConfiguration config = new RTCConfiguration
{
iceServers = new List<RTCIceServer>() { new RTCIceServer { urls = this.STUN_URL } }
};
RTCPeerConnection peerConnection = new RTCPeerConnection(config);
I had a look at the code
setRemoteDescription
and it's supposed to change the SignalingState and add the ice candidate but it's not changing the state so this won't workpeerConnection.onicecandidate += (iceCandidate) =>
as it checkspeerConnection.signalingState == RTCSignalingState.have_remote_offer
.The signaling state is stuck at
have_local_offer
.The thing is that remote description gets set as if I do
Console.WriteLine(($"remote description {this.peerConnection.remoteDescription.sdp}");)
I get the following:remote description v=0 o=- 86432 0 IN IP4 127.0.0.1 s=sipsorcery t=0 0
I don't need any media settings as I will use the peer connection for exchanging strings.
I'm sure I'm missing something but I don't understand what as there are no errors or warnings