I have an audio stream through a URL and I need to be able to play it preferably with NAudio but I cant seem to get it to work or find anyone else who has tried doing what I need. I don't want to save the audio stream as a file I want to get the audio stream I have and send the bytes elsewhere.
This is what I have so far:
When run it just plays a bunch of static.
This is what I have so far:
Code
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(e.Args[0]);
VideoInfo video = videoInfos.Where(info => info.CanExtractAudio).OrderByDescending(info => info.AudioBitrate).First();
Console.WriteLine(video.Title + " Bitrate: " + video.AudioBitrate);
using (Stream stream = WebRequest.Create(video.DownloadUrl).
GetResponse().
GetResponseStream())
{
var outFormat = new WaveFormat(48000, 16, 1);
int blockSize = outFormat.AverageBytesPerSecond / 5;
byte[] buffer = new byte[blockSize];
int read;
while((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
voice.SendVoicePCM(buffer, read);
}
}When run it just plays a bunch of static.


