add controller for video

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-07-22 16:01:28 +03:00
parent bfbfdf6658
commit 6f78b88007
7 changed files with 80 additions and 35 deletions
@@ -0,0 +1,10 @@
namespace Azaion.Repository;
public class Constants
{
public const string MEDIA_HLS_FOLDER = "/azaion-media/hls";
public const string M3_U8_EXT = "m3u8";
public const string TS_EXT = "ts";
public const string FFMPEG_FILE = "/opt/homebrew/bin/ffmpeg";
}
@@ -1,12 +1,22 @@
using Azaion.Video.DTO;
using IOPath = System.IO.Path;
namespace Azaion.Repository.Entities;
public class Media
{
public Guid Id { get; set; }
public string Path { get; set; } = null!;
public Guid? AnnotatorId { get; set; }
public MediaStatusEnum Status { get; set; }
public DateTime CreatedDate { get; set; }
public Guid Id { get; set; }
public string Path { get; set; } = null!;
public int Resolution { get; set; }
public int Bitrate { get; set; }
public Guid? AnnotatorId { get; set; }
public MediaStatusEnum Status { get; set; }
public DateTime CreatedDate { get; set; }
private string MediaName => IOPath.GetFileNameWithoutExtension(Path);
private string OutDir => Directory.CreateDirectory(IOPath.Combine(Constants.MEDIA_HLS_FOLDER, MediaName)).FullName;
public string M3U8File => IOPath.Combine(OutDir, $"{MediaName}.{Constants.M3_U8_EXT}");
public string SegmentFile => IOPath.Combine(OutDir, $"{MediaName}%03d.{Constants.TS_EXT}");
}