title: C# How do I send a video over HTTP with partial content?
body: <p>I'm currently building a "video server", it has to be able to send videos over HTTP to the client which is using an HTML( tag) website.
  I have this video tag on the website:</p>
  
  <pre><code>&lt;video src="http://&lt;?php echo $_SERVER['SERVER_ADDR']; ?&gt;:8080/stream/0c73f95521d163257379e8ed37839e34" autoplay controls muted&gt;&lt;/video&gt;
  </code></pre>
  
  <p>And this code on my server: (ctx is my HttpListenerContext)</p>
  
  <pre><code>string file = Directory.GetFiles(
  contentDirectory,
  ctx.Request.RawUrl.Substring(("/stream/").Length) + ".*",
  SearchOption.AllDirectories)[0];
  
  //Console.Log(ctx.Request.Headers.GetValues("Range")[0]);
  
  byte[] data = File.ReadAllBytes(file);
  ctx.Response.OutputStream.Write(data, 0, data.Length);
  ctx.Response.OutputStream.Flush();
  ctx.Response.OutputStream.Close();
  </code></pre>
  
  <p>I have been looking for a method that works but I haven't found any.</p>
  
  <p>Basically what I'm trying to do is send video over HTTP from my C# program to my website (which is hosted on another web server).</p>
  
  <p><strong>Update:</strong>
  I found this answer yesterday but didn't think I worked because I used an HttpListener, when I read it a bit closer I found that he used a TcpListener.
  <a href="https://stackoverflow.com/a/25920607/2989196">Handle range requests with HttpListener</a></p>
  
  <p>I hope this might help someone else!</p>
  
  <p>Thank you!</p>