mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 19:36:30 +00:00
add controller for video
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user