我有一个包含多个直播流的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发布于 2016-05-02 01:51:48
你可以发一个m3u文件作为例子吗?我记得m3u文件只是文本文件。据我所知,你可以使用NotePad打开它们并查看它们的链接。每个链接都在一行中,所以你也可以很容易地在你的应用程序中将它们分开,一个接一个地播放。像这样的东西可以帮助你
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);
}
}https://stackoverflow.com/questions/36954623
复制相似问题