M3U[
^] is a playlist; it's a plain-text file containing a list of URLs representing the files to play, and optionally comment lines starting with
#
.
You'll need to read the contents of the file, extract any URLs, and process them accordingly:
IEnumerable<Uri> LoadPlaylist(Uri source)
{
using (var client = new WebClient())
{
var processedPlaylists = new HashSet<Uri>();
var playlists = new Queue<Uri>();
playlists.Enqueue(source);
while (playlists.Count != 0)
{
Uri playlistUri = playlists.Dequeue();
if (!processedPlaylists.Add(playlistUri)) continue;
string playlistContent = client.DownloadString(playlistUri);
string[] playlistLines = playlistContent.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in playlistLines)
{
if (string.IsNullOrWhiteSpace(line)) continue;
if (line[0] == '#') continue;
Uri file;
if (!Uri.TryCreate(source, line, out file))
{
Console.WriteLine("Invalid line: '{0}'", line);
continue;
}
string extension = Path.GetExtension(file.LocalPath);
if (extension.StartsWith(".m3u", StringComparison.OrdinalIgnoreCase))
{
playlists.Enqueue(file);
}
else
{
yield return file;
}
}
}
}
}
Running that against the URL in your question produces three
.aac
files:
Advanced Audio Coding - Wikipedia, the free encyclopedia[
^]
If you want to use that playlist, then you'll need to update your module to support that file type.