public void PlayerData(TcpSocketSaeaSession session) { byte[] payload = session.CompletedBuffer.GetMessageBody(); try { if (!_isRun || _Player == null || _isPlaying == false) { return; //正在录音不播放 } _Player.PlayData(payload); } catch { } }
public async void PlayerData(SessionHandler session) { var payload = session.CompletedBuffer.GetMessageBody(); if (_isRun && _player != null && IsPlaying == true) { try { this.Invoke(new Action(() => { recvLen += payload.Length; recvdataLen.Text = (recvLen / 1024).ToString() + " KB"; })); _player.PlayData(payload); if (this._isRecord) { await _fileStream.WriteAsync(payload, 0, payload.Length); } } catch { } } }