using AZKiServer.Services; using Microsoft.AspNetCore.Mvc; using MongoDB.Bson; namespace AZKiServer.Controllers; [Route("/m/")] public class MediaController(MediaService mediaService, IConfiguration configuration) : Controller { private readonly string _basePath = configuration["SCAN_LOCATION"] ?? throw new NullReferenceException("SCAN_LOCATION is not set"); [HttpGet("v/{id}")] [ResponseCache(Duration = int.MaxValue)] public async Task VideoAsync(ObjectId id) { var media = await mediaService.GetEntryAsync(id); if (media == null) return NotFound(); if (media.Type != Models.MediaType.Video) return BadRequest(); var filePath = Path.Combine(_basePath, media.Filepath); //var fs = new FileStream(, FileMode.Open); return PhysicalFile(filePath, "video/mp4", true); } }