I am having trouble using await with a method from the Unity WebRTC implementation (I am using version 2.2.0-preview). Most methods which are supposed to be called in a coroutine seem to be working fine, but RTCPeerConnection.CreateAnswer() returns null when I use await.
What I am doing is roughly this:
// WebRTC.Initialize() is already called
// The remoteDescription comes from my signaling server
this.localConnection = new RTCPeerConnection(ref rtcConfig);
await localConnection.SetRemoteDescription(ref remoteDescription);
var answerOptions = new RTCAnswerOptions { iceRestart = false };
var answer = await localConnection.CreateAnswer(ref answerOptions);
// After this answer == null
When I call CreateAnswer() inside a Coroutine, I get a RTCSessionDescription description as expected.
var answerOptions = new RTCAnswerOptions { iceRestart = false };
var answer = localConnection.CreateAnswer(ref answerOptions);
yield return answer;
// After the yield, anser is *not* null and contains a session description in answer.Desc
Hello everyone!
I am having trouble using
await
with a method from the Unity WebRTC implementation (I am using version 2.2.0-preview). Most methods which are supposed to be called in a coroutine seem to be working fine, butRTCPeerConnection.CreateAnswer()
returnsnull
when I useawait
.What I am doing is roughly this:
When I call
CreateAnswer()
inside a Coroutine, I get aRTCSessionDescription
description as expected.The return value of
RTCPeerConnection.CreateAnswer
is a RTCSessionDescriptionAsyncOperation.Do I need a special Awaiter here that is not covered by
IEnumeratorAwaitExtensions
?Any tipps and hints in the right direction would be greatly appreciated!
Thanks in advance for any insights you could provide on this issue and best regards, Patrick