I want to stream video captured from the webcam using ASP.NET Core application. I also need to do some manipulations with the frames, that's why I'm using OpenCVSharp.
Currently I have next developments:
- html in my view - here I don't know what type I should use
<video id="video" preload="auto">
<source src="LiveVideo" type="<< don't know the type >>"/>
</video>
- my controller - here I also don't know the content type, and the main problem: I don't know how to stream the video captured by OpenCVSharp
[ApiController]
[Route("[controller]")]
public class LiveVideoController : ControllerBase
{
[HttpGet]
public async Task<FileStreamResult> GetVideo()
{
// capture frames from webcam
// https://github.com/shimat/opencvsharp/wiki/Capturing-Video
var capture = new VideoCapture(0);
var stream = await << somehow get the stream >>;
return new FileStreamResult(stream, << don't know the content type >>);
}
}