I\'m in the process of working out what the best way is going to be to do the following:
I have a bunch of CCTV footage files (MP4 files, ranging from 4MB-50MB in size),
Two things:
Use a video element in your HTML (this works in browsers AND iOS):
Support 206 PARTIAL CONTENT
requests in you Web API code. This is crucial for both streaming and iOS support, and is mentioned in that thread you posted.
Just follow this example:
https://devblogs.microsoft.com/aspnet/asp-net-web-api-and-http-byte-range-support/
In a nutshell:
if (Request.Headers.Range != null)
{
// Return part of the video
HttpResponseMessage partialResponse = Request.CreateResponse(HttpStatusCode.PartialContent);
partialResponse.Content = new ByteRangeStreamContent(stream, Request.Headers.Range, mediaType);
return partialResponse;
}
else
{
// Return complete video
HttpResponseMessage fullResponse = Request.CreateResponse(HttpStatusCode.OK);
fullResponse.Content = new StreamContent(stream);
fullResponse.Content.Headers.ContentType = mediaType;
return fullResponse;
}