-1

I want to create an audio streaming server and changing the playlist dynamicly. My idea to solve this problem is using libvlcsharp and just put a memorystream as media into the mediaplayer and then stream from libvlcsharp to my nginx RTMP server.

Here is the code for my memorystream:

new Thread(delegate (object o)
        {
            var response = WebRequest.Create("http://listen.technobase.fm/tunein-aacplus-pls").GetResponse();
            using (var stream = response.GetResponseStream())
            {
                byte[] buffer = new byte[65536];
                int read;
                while((read = stream.Read(buffer,0,buffer.Length)) > 0)
                {
                    var pos = ms.Position;
                    ms.Position = ms.Length;
                    ms.Write(buffer, 0, read);
                    ms.Position = pos;
                }
            }
        }).Start();

But the media item from libvlcsharp just don't accept a memorystream as input. This is what I tried:

var media = new Media(_libVLC, ms);
_mp.Play(media);

Is it feasible to put a memorystream into VLC or is there another possibility to solve this issue?

Innoszorn
  • 139
  • 1
  • 15

1 Answers1

4

Problem solved.

media = new Media(_libVLC, new StreamMediaInput(ms));
Innoszorn
  • 139
  • 1
  • 15