private void OnOpenDeviceStatusEventHandler(AudioAdapterHandler adapterHandler, bool playerState, bool recordState) { if (!playerState && !recordState) { tip.Text = "远程计算机的播放设备与录音设备未找到!"; } else if (playerState && !recordState) { tip.Text = "远程录音设备未找到,但可向远程发起说话..........."; } else if (!playerState && recordState) { tip.Text = "正在监听远程声音,但远程播放设备未找到..........."; } else if (playerState && recordState) { tip.Text = "正在监听远程声音,并且您可以向远程发起说话..........."; } }
private void OnPlayerEventHandler(AudioAdapterHandler adapterHandler, byte[] voiceData) { if (this._isRun && this._player != null && this._isPlaying == true) { try { this.Invoke(new Action(() => { this._recvVoiceDataLength += voiceData.Length; recvdataLen.Text = (this._recvVoiceDataLength / 1024).ToString() + " KB"; })); this._player.PlayData(voiceData); if (this._isRecord) { this._pcmStreamToWavHelper.WritePCMDataChunk(voiceData); } } catch { } } }
private async void OnPlayerEventHandler(AudioAdapterHandler adapterHandler, byte[] voiceData) { if (this._isRun && this._player != null && this._isPlaying == true) { try { this.Invoke(new Action(() => { this._recvVoiceDataLength += voiceData.Length; recvdataLen.Text = (this._recvVoiceDataLength / 1024).ToString() + " KB"; })); this._player.PlayData(voiceData); if (this._isRecord) { await this._fileStream.WriteAsync(voiceData, 0, voiceData.Length); } } catch { } } }