0

i create vlc playlist xspf file now i want to stream it with Libvlcsharp codes as follows. this code working fine with video file but .xspf file not respond

code :

LibVLCSharp.Shared.LibVLC _libVLC; MediaPlayer _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");
  • The page https://www.videolan.org/developers/vlc-branch/doc/doxygen/html/group__libvlc__media__list__player.html says that the media player cannot play a playlist, only single media. However, as far as I know, the XSPF parser is not part of the libvlc API, which means that you would need to parse that yourself – cube45 Nov 19 '19 at 06:02

1 Answers1

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();
    }
}
mfkl
  • 1,914
  • 1
  • 11
  • 21