public void StopAudioInjection() { if (!ChannelSessions.Any((cs) => cs.AudioState == ConnectionState.Connected || cs.TextState == ConnectionState.Connected) || IsInjectingAudio == false) { VivoxDebug.Instance.DebugMessage($"{GetType().Name}: StopAudioInjection() warning; No audio injection to stop", vx_log_level.log_warning); return; } vx_req_sessiongroup_control_audio_injection_t request; request = new vx_req_sessiongroup_control_audio_injection_t { sessiongroup_handle = _groupHandle, audio_injection_control_type = vx_sessiongroup_audio_injection_control_type.vx_sessiongroup_audio_injection_control_stop }; VxClient.Instance.BeginIssueRequest(request, result => { try { VxClient.Instance.EndIssueRequest(result); IsInjectingAudio = false; } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); } }); }
public void StartAudioInjection(string audioFilePath) { if (!ChannelSessions.Any((cs) => cs.AudioState == ConnectionState.Connected)) { throw new InvalidOperationException($"{GetType().Name}: StartAudioInjection() failed for InvalidState: The channel's AudioState must be connected"); } vx_req_sessiongroup_control_audio_injection_t request; request = new vx_req_sessiongroup_control_audio_injection_t { sessiongroup_handle = _groupHandle, filename = audioFilePath, audio_injection_control_type = vx_sessiongroup_audio_injection_control_type.vx_sessiongroup_audio_injection_control_start }; VxClient.Instance.BeginIssueRequest(request, result => { try { VxClient.Instance.EndIssueRequest(result); IsInjectingAudio = true; } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); if (VivoxDebug.Instance.throwInternalExcepetions) { throw; } } }); }