title: LibVLCSharp record while streaming
body: <p>I am trying to implement a record button into my LibVLC rtsp stream. The recording works but when i try to record it it only records the RTSP stream for 3 seconds and when it does the recording the stream stops completely. How do I make it stream continuously while recording the RTSP stream? The code is below. I'm still learning C# so please give me a chance!</p>
  
  <pre class="lang-cs prettyprint-override"><code>void RecordButton_Click(object sender, RoutedEventArgs e)
  {       
      var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
      var destination = Path.Combine(currentDirectory, "record.mp4");
  
      rtsp1.AddOption(":screen-fps=24");
      rtsp1.AddOption(":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:file{dst=record1.mp4}");
      rtsp1.AddOption(":sout-keep");
  
      VideoView2.MediaPlayer.Play(rtsp1); // start recording
  
      //await Task.Delay(5000); // record for 5 seconds
      System.Threading.Thread.Sleep(5000);
      VideoView2.MediaPlayer.Stop(); // stop recording and saves the file
  }
  </code></pre>