add controller for video

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-07-22 16:01:28 +03:00
parent bfbfdf6658
commit 6f78b88007
7 changed files with 80 additions and 35 deletions
@@ -0,0 +1,19 @@
using Azaion.Video;
using Microsoft.AspNetCore.Mvc;
namespace Azaion.WebService.Controllers;
[Route("/controller")]
[ApiController]
public class VideoController(IVideoManager videoManager) : Controller
{
[HttpGet("{guid}")]
public IActionResult GetVideo(Guid guid)
{
var media = videoManager.Get(guid);
var fileStream = new FileStream(media.M3U8File, FileMode.Open);
var fileSize = new FileInfo(media.Path).Length;
Response.ContentLength = fileSize;
return File(fileStream, "application/x-mpegURL", true);
}
}