Linux
0
Вклад в тег
LibVLCSharp.Shared.Core.Initialize();
_libVLC = new LibVLC();
mediaPlayer = new MediaPlayer(_libVLC);
_media = new Media(_libVLC, "dshow://", FromType.FromLocation);
string tempDir = Path.GetTempPath();
FileName = "record" + DateTime.Now.Ticks + ".mp3";
FilePath = Path.Combine(tempDir, FileName);
_media.AddOption($@":dshow-adev={SelectedSource}");
_media.AddOption(
$@":sout=#transcode{{acodec=mp3,ab=512,channels=2,samplerate=44100}}:file{{dst={FilePath}}}");
_media.AddOption(":sout-keep");
mediaPlayer.Play(_media);
_media = new Media(_libVLC, new Uri(FilePath));
mediaPlayer = new MediaPlayer(_media);
mediaPlayer.EndReached += MediaEndReached;
mediaPlayer.Play();
IsPlaying = true;