Files
ersatztv/ErsatzTV/Controllers/Api/SessionController.cs
T
Jason DoveandGitHub 7fffc8cf63 channel preview player (#1579)
* add channel preview

* add button to stop transcoding session
2024-01-29 20:52:52 -06:00

27 lines
761 B
C#

using ErsatzTV.Core.FFmpeg;
using ErsatzTV.Core.Interfaces.FFmpeg;
using Microsoft.AspNetCore.Mvc;
namespace ErsatzTV.Controllers.Api;
[ApiController]
public class SessionController(IFFmpegSegmenterService ffmpegSegmenterService)
{
[HttpGet("api/sessions")]
public List<HlsSessionModel> GetSessions()
{
return ffmpegSegmenterService.Workers.Map(w => w.GetModel()).ToList();
}
[HttpDelete("api/session/{channelNumber}")]
public async Task<IActionResult> StopSession(string channelNumber, CancellationToken cancellationToken)
{
if (await ffmpegSegmenterService.StopChannel(channelNumber, cancellationToken))
{
return new NoContentResult();
}
return new NotFoundResult();
}
}