video playback and timeline playhead

This commit is contained in:
2026-03-05 19:18:45 -05:00
parent 20874ecff7
commit 78651ca58d
8 changed files with 227 additions and 37 deletions

View File

@@ -0,0 +1,27 @@
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<IActionResult> 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);
}
}