public bool Answer(int friendNumber, int audioBitrate, int videoBitrate) { ToxAvErrorAnswer error; var retVal = _toxAv.Answer(friendNumber, audioBitrate, videoBitrate, out error); ToxErrorViewModel.Instance.RelayError(error); return(retVal); }
public void Answer() { ToxAvError error = toxav.Answer(CallIndex, ToxAv.DefaultCodecSettings); if (error != ToxAvError.None) { throw new Exception("Could not answer call " + error.ToString()); } }
public void TestToxAvCallAndAnswer() { var options = new ToxOptions(true, true); var tox1 = new Tox(options); var tox2 = new Tox(options); var toxAv1 = new ToxAv(tox1); var toxAv2 = new ToxAv(tox2); bool testFinished = false; Task.Run(async() => { while (!testFinished) { int time1 = tox1.Iterate(); int time2 = tox2.Iterate(); await Task.Delay(Math.Min(time1, time2)); } }); tox1.AddFriend(tox2.Id, "hey"); tox2.AddFriend(tox1.Id, "hey"); while (tox1.GetFriendConnectionStatus(0) == ToxConnectionStatus.None) { Thread.Sleep(10); } bool answered = false; toxAv1.Call(0, 48, 30000); toxAv2.OnCallRequestReceived += (sender, e) => { var error2 = ToxAvErrorAnswer.Ok; bool result2 = toxAv2.Answer(e.FriendNumber, 48, 30000, out error2); }; toxAv1.OnCallStateChanged += (sender, e) => { answered = true; }; while (!answered) { Thread.Sleep(10); } testFinished = true; toxAv1.Dispose(); toxAv2.Dispose(); tox1.Dispose(); tox2.Dispose(); }
public void Init() { var options = new ToxOptions(true, true); _tox1 = new Tox(options); _tox2 = new Tox(options); _toxAv1 = new ToxAv(_tox1); _toxAv2 = new ToxAv(_tox2); _tox1.AddFriend(_tox2.Id, "hey"); _tox2.AddFriend(_tox1.Id, "hey"); while (_tox1.GetFriendConnectionStatus(0) == ToxConnectionStatus.None) { DoIterate(); } bool answered = false; _toxAv1.Call(0, 48, 3000); _toxAv2.OnCallRequestReceived += (sender, e) => { var error2 = ToxAvErrorAnswer.Ok; bool result2 = _toxAv2.Answer(e.FriendNumber, 48, 3000, out error2); }; _toxAv1.OnCallStateChanged += (sender, e) => { answered = true; }; while (!answered) { DoIterate(); } }