mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 09:46:30 +00:00
7807f5bc90
configure auto-scan folder and create hls files job WIP
23 lines
693 B
C#
23 lines
693 B
C#
using Azaion.Repository.DTO.Configs;
|
|
using Azaion.Video;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace Azaion.WebService.Controllers;
|
|
|
|
[Route("/{controller}")]
|
|
[ApiController]
|
|
public class VideoController(IVideoRepository videoRepository, IOptions<FoldersConfig> config) : Controller
|
|
{
|
|
[HttpGet("{guid}")]
|
|
public IActionResult GetVideo(Guid guid)
|
|
{
|
|
var media = videoRepository.Get(guid);
|
|
var fileStream = new FileStream(media.M3U8File(config), FileMode.Open);
|
|
var fileSize = new FileInfo(media.Path).Length;
|
|
Response.ContentLength = fileSize;
|
|
return File(fileStream, "application/x-mpegURL", true);
|
|
}
|
|
|
|
}
|