2

我有一个包含许多直播流的 M3U 文件,如何访问和打开它?

myMediaElement.Source = new Uri("http://12345.net/09876.m3u");

这工作“很好”,但只播放第一个流。
有什么解决办法吗?
提前致谢。

来自维基百科的 M3U 示例:

#EXTM3U

#EXTINF:123, Sample artist - Sample title
C:\Documents and Settings\I\My Music\Sample.mp3

#EXTINF:321,Example Artist - Example title
C:\Documents and Settings\I\My Music\Greatest Hits\Example.ogg
4

1 回答 1

2

例如,您能否发布一个 m3u 文件。我记得 m3u 文件只是文本文件。据我所知,您可以使用记事本打开它们并查看它们的链接。每个链接都排成一行,因此您也可以在应用程序中轻松地将它们分开并逐个播放。像这样的东西可以帮助你

var lines = await Windows.Storage.FileIO.ReadLinesAsync(App.ProgramsIndex, Windows.Storage.Streams.UnicodeEncoding.Utf8);
        foreach (var line in lines)
        {
            if (string.IsNullOrWhiteSpace(line) || line.StartsWith("#"))
            {
                //Skip This Line
            }
            else
            {
                //Do whatever you want .
                Windows.Storage.StorageFile.GetFileFromPathAsync(line);
            }
        }
于 2016-05-01T17:51:48.497 回答