Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration problem with Unity WebRTC #21

Open
yrucrem opened this issue Oct 30, 2020 · 0 comments
Open

Integration problem with Unity WebRTC #21

yrucrem opened this issue Oct 30, 2020 · 0 comments

Comments

@yrucrem
Copy link

yrucrem commented Oct 30, 2020

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, 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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant