refactor
This commit is contained in:
28
Services/Internal/AudioService.cs
Normal file
28
Services/Internal/AudioService.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Kasbot.Services.Internal
|
||||
{
|
||||
public class AudioService
|
||||
{
|
||||
public AudioService() { }
|
||||
|
||||
public Process CreateStream()
|
||||
{
|
||||
var process = Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "ffmpeg",
|
||||
Arguments = $"-hide_banner -loglevel panic -i pipe:0 -ac 2 -f s16le -ar 48000 pipe:1",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true
|
||||
});
|
||||
|
||||
if (process == null || process.HasExited)
|
||||
{
|
||||
throw new Exception("Sorry, ffmpeg killed itself in a tragic accident!");
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user