public bool Answer(int friendNumber, int audioBitrate, int videoBitrate, out ToxAvErrorAnswer error) { ThrowIfDisposed(); error = ToxAvErrorAnswer.Ok; return(ToxAvFunctions.Answer(_toxAv, ToxTools.Map(friendNumber), (uint)audioBitrate, (uint)videoBitrate, ref error)); }
public bool Answer(uint friendNumber, uint audioBitrate, uint videoBitrate, out ToxAvErrorAnswer error) { ThrowIfDisposed(); error = ToxAvErrorAnswer.Ok; return(ToxAvFunctions.Answer(AvHandle, friendNumber, audioBitrate, videoBitrate, ref error)); }
public void RelayError(ToxAvErrorAnswer error) { if (error != ToxAvErrorAnswer.Ok) { Debug.WriteLine("An unexpected error occurred when answering a call: " + error); } }
internal static extern bool Answer(ToxAvHandle toxAv, uint friendNumber, uint audioBitrate, uint videoBitrate, ref ToxAvErrorAnswer error);
public static extern Boolean Answer(ToxAvHandle toxAv, UInt32 friendNumber, UInt32 audioBitrate, UInt32 videoBitrate, ref ToxAvErrorAnswer error);
public void RelayError(ToxAvErrorAnswer error) { if (error != ToxAvErrorAnswer.Ok) Debug.WriteLine("An unexpected error occurred when answering a call: " + error); }
public bool Answer(int friendNumber, bool enableRecording, bool enablePlayback, bool enableLocalVideo, bool enableFriendVideo) { // stop ringing this.StopRingingSound(); if (this.callInfo != null) { Logger.Log(LogLevel.Warning, "Tried to answer a call but there is already one in progress"); return(false); } ToxAvErrorAnswer error = ToxAvErrorAnswer.Ok; if (!this.toxAv.Answer(friendNumber, DefaultAudioBitrate, DefaultVideoBitrate, out error)) { Logger.Log(LogLevel.Error, "Could not answer call for friend: " + error); return(false); } ToxAvCallControl audioControl = enablePlayback ? ToxAvCallControl.UnmuteAudio : ToxAvCallControl.MuteAudio; ToxAvErrorCallControl audioError = ToxAvErrorCallControl.Ok; if (!this.toxAv.SendControl(friendNumber, audioControl, out audioError)) { Logger.Log(LogLevel.Error, "Could not change audio receiving: " + audioError); } ToxAvCallControl videoControl = enableFriendVideo ? ToxAvCallControl.ShowVideo : ToxAvCallControl.HideVideo; ToxAvErrorCallControl videoError = ToxAvErrorCallControl.Ok; if (!this.toxAv.SendControl(friendNumber, videoControl, out videoError)) { Logger.Log(LogLevel.Error, "Could not change video receiving: " + videoError); } // disable local audio/video monitors this.RestartRecordingMonitor(false); this.RestartPlaybackMonitor(false); this.RestartVideoMonitor(false); ToxAvFriendCallState friendCallState = ToxAvFriendCallState.Paused; if (enableRecording) { friendCallState |= ToxAvFriendCallState.ReceivingAudio; } if (enablePlayback) { friendCallState |= ToxAvFriendCallState.SendingAudio; } if (enableLocalVideo) { friendCallState |= ToxAvFriendCallState.ReceivingVideo; } if (enableFriendVideo) { friendCallState |= ToxAvFriendCallState.SendingVideo; } this.callInfo = new CallInfo(friendNumber, enableRecording, enablePlayback, enableLocalVideo, enableFriendVideo); this.callInfo.FriendCallState = friendCallState; this.callInfo.RecordingDevice.OnMicVolumeChanged += this.OnAudioDeviceMicVolumeChanged; this.callInfo.RecordingDevice.OnMicDataAvailable += this.OnAudioDeviceMicDataAvailable; this.callInfo.VideoDevice.OnFrameAvailable += this.OnVideoDeviceFrameAvailable; var audioBitrateError = ToxAvErrorSetBitrate.Ok; bool audioBitrateSet = this.toxAv.SetAudioBitrate(friendNumber, DefaultAudioBitrate, out audioBitrateError); if (!audioBitrateSet) { Logger.Log(LogLevel.Error, string.Format("Could not set audio bitrate to {0}, error: {1}", DefaultAudioBitrate, audioBitrateError)); } var videoBitrateError = ToxAvErrorSetBitrate.Ok; bool videoBitrateSet = this.toxAv.SetVideoBitrate(friendNumber, DefaultVideoBitrate, out videoBitrateError); if (!videoBitrateSet) { Logger.Log(LogLevel.Error, string.Format("Could not set video bitrate to {0}, error: {1}", DefaultVideoBitrate, videoBitrateError)); } if (audioBitrateSet) { this.callInfo.AudioBitrate = DefaultAudioBitrate; } if (videoBitrateSet) { this.callInfo.VideoBitrate = DefaultVideoBitrate; } if (enableRecording) { this.callInfo.RecordingDevice.StartRecording(); } if (enableLocalVideo) { this.callInfo.VideoDevice.StartRecording(); } return(true); }