Esempio n. 1
0
        public IAsyncResult BeginSetChannelTranscription(bool value, string accessToken, AsyncCallback callback)
        {
            AssertSessionNotDeleted();
            AsyncNoResult ar = new AsyncNoResult(callback);

            // No need to issue the request if the current value is already what was passed in.
            if (_isSessionBeingTranscribed == value)
            {
                VivoxDebug.Instance.DebugMessage($"IsSessionBeingTranscribed is already {value.ToString()}. Returning.", vx_log_level.log_debug);
                ar.SetComplete();
                return(ar);
            }
            var request = new vx_req_session_transcription_control_t
            {
                session_handle = this._sessionHandle,
                enable         = value ? 1 : 0,
                access_token   = accessToken
            };

            VxClient.Instance.BeginIssueRequest(request, result =>
            {
                try
                {
                    var response = VxClient.Instance.EndIssueRequest(result);
                    if (response.status_code == 0)
                    {
                        _isSessionBeingTranscribed = Convert.ToBoolean(request.enable);
                    }
                }
                catch (Exception e)
                {
                    VivoxDebug.Instance.DebugMessage($"BeginSetChannelTranscription() failed {e}", vx_log_level.log_error);
                    ar.SetComplete(e);
                    return;
                }
                ar.SetComplete();
            });
            return(ar);
        }
Esempio n. 2
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(vx_req_session_transcription_control_t obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }