Cross platform audio player in dotnet

1 min read Original article ↗
// I've used a lot of libs including the popular ones for dotnet such as NAudio but all seem to be overly complicated or not cross platform.
// 1. install ffplay on your platform. for Windows `choco install ffplay`. Debian `apt install ffmpeg`.
// 2. install nuget pkg `CliWrap`
// 3. send your audio stream to the method.
public static async Task PlayAsync(Stream stream, CancellationToken cancellationToken)
{
var result = await Cli.Wrap("ffplay")
.WithStandardInputPipe(PipeSource.FromStream(stream))
.WithArguments($"-autoexit -nodisp -hide_banner -loglevel error -fs -")
.ExecuteAsync();
}