public void OnSetSuccess()
{
outerInstance.RunOnUiThread(() =>
{
if (outerInstance.appRtcClient.Initiator)
{
if (outerInstance.pc.RemoteDescription != null)
{
// We've set our local offer and received & set the remote
// answer, so drain candidates.
drainRemoteCandidates();
}
}
else
{
if (outerInstance.pc.LocalDescription == null)
{
// We just set the remote offer, time to create our answer.
outerInstance.logAndToast("Creating answer");
outerInstance.pc.CreateAnswer(this, outerInstance.sdpMediaConstraints);
}
else
{
// Sent our answer and set it as local description; drain
// candidates.
drainRemoteCandidates();
}
}
});
}