mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 21:46:30 +00:00
add controller for video
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using Azaion.Repository;
|
||||
using Azaion.Repository.DTO;
|
||||
using Azaion.Repository.Entities;
|
||||
|
||||
namespace Azaion.Video;
|
||||
|
||||
@@ -18,12 +20,36 @@ public class VideoManager(IDbFactory dbFactory) : IVideoManager
|
||||
})
|
||||
.ToList());
|
||||
}
|
||||
|
||||
public void OpenVideo(Guid mediaId)
|
||||
|
||||
public void EncodeVideo(Guid mediaId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var media = dbFactory.Run(db => db.Medias.SingleOrDefault(x => x.Id == mediaId))!;
|
||||
|
||||
string arguments = string.Concat($"-i \"{media.Path}\" ",
|
||||
"-f hls ",
|
||||
"-hls_time 2 ",
|
||||
"-hls_playlist_type vod ",
|
||||
"-hls_flags independent_segments ",
|
||||
"-hls_segment_type mpegts ",
|
||||
$"-hls_segment_filename \"{media.SegmentFile}\"",
|
||||
$"\"{media.M3U8File}\"");
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = new()
|
||||
{
|
||||
FileName = Constants.FFMPEG_FILE,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = true,
|
||||
},
|
||||
EnableRaisingEvents = true,
|
||||
};
|
||||
process.Start();
|
||||
}
|
||||
|
||||
public Media Get(Guid mediaId) =>
|
||||
dbFactory.Run(db => db.Medias.SingleOrDefault(x => x.Id == mediaId))!;
|
||||
|
||||
public void OpenTestVideo()
|
||||
{
|
||||
|
||||
@@ -31,6 +57,5 @@ public class VideoManager(IDbFactory dbFactory) : IVideoManager
|
||||
|
||||
public void FinishAnnotation(Guid mediaId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user