0

我现在创建 vlc 播放列表 xspf 文件,我想使用 Libvlcsharp 代码流式传输它,如下所示。此代码适用于视频文件但 .xspf 文件没有响应

代码 :

LibVLCSharp.Shared.LibVLC _libVLC; 媒体播放器_mp;

                _libVLC = new LibVLCSharp.Shared.LibVLC("-I", "null");
                _mp = new MediaPlayer(_libVLC);

                 string xspf_file = @"D:\sample.xspf";

                var media1 = new Media(_libVLC,xspf_file,FromType.FromPath);

                media1.AddOption(":sout=#transcode{acodec=mp4a,ab=128,channels=2,samplerate=44100,scodec=none}:udp{dst=224.2.2.26:2226,mux=ts}");


                _mp.Play(media1);

                MessageBox.Show("play success");
4

1 回答 1

1
Core.Initialize();

using(var libVLC = new LibVLC())
{
    var media = new Media(libVLC, "playlist.xspf");
    await media.Parse(MediaParseOptions.ParseNetwork);

    using (var mp = new MediaPlayer(media.SubItems.First()))
    {
        media.Dispose();
        mp.Play();
        Console.ReadKey();
    }
}
于 2019-11-20T01:06:46.990 回答