I have a stream url of my webcam, that returns a content-type of "multipart/x-mixed-replace;boundary=myboundary", let say that it is accessible via http://mywebcam/livrestream.cgi
I would like to create a proxy in ASP.NET CORE that can return the same stream.
I've created a route that get the stream :
[Route("api/test")]
[HttpGet]
public async Task<HttpResponseMessage> Test()
{
var client = new HttpClient();
var inputStream = await client.GetStreamAsync("http://mywebcam/livrestream.cgi");
var response = new HttpResponseMessage();
response.Content = new PushStreamContent((stream, httpContent, transportContext) =>
{
// what to do ?
}, "video/mp4");
return response;
}
It seems that I have to use PushStreamContent. But what should I do ? An endless while loop that query regulary the stream ? something else ?