Skip to content

Integration problem with Unity WebRTC #21

Open
@yrucrem

Description

@yrucrem

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions