0

I am able to open an sdp file in VLC to view a udp livestream from gstreamer. I would like to do the same in WPF. I followed this example: https://github.com/videolan/libvlcsharp/blob/3.x/samples/LibVLCSharp.WPF.Sample/Example2.xaml.cs But edited the PlayButton_Click function to take in an sdp file instead (see below).

void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            if (!VideoView.MediaPlayer.IsPlaying)
            {
                using (var media = new Media(_libVLC, "sdp://" +
                                                        "v=0\n" +
                                                        "c=IN IP4 <replace w client IP> \n" +
                                                        "m=video 5000 RTP/AVP 96\n" +
                                                        "a=rtpmap:96 H265/90000\n" +
                                                        "a=fmtp:96 media=video;clock-rate=90000;encoding-name=H265",
                                                        FromType.FromLocation))
                    VideoView.MediaPlayer.Play(media);
            }
        }

But no video plays when i click the play button. I am certain that the rest of my code is correct because I can play the Big Buck Bunny video by swapping out the sdp string with new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4").

How do I correctly input the sdp file into LibVLCSharp media?

Jamie9057
  • 1
  • 1

1 Answers1

0

Are you sure the url syntax is correct? how would you do with VLC?

I'd rather have the .sdp file path in the url (see other samples about playing a file) or using a StreamMediaInput to provide the sdp content.

cube45
  • 3,429
  • 2
  • 24
  • 35
  • Do you mean setting `var media = new Media(_libVLC, new Uri())`? I have tried that but to no avail. When I click on the play button, no video is displayed – Jamie9057 Dec 21 '21 at 08:57
  • i also checked the url syntax for sdp input against: https://forum.videolan.org/viewtopic.php?t=149657, not sure how much different the syntax is for wpf vs uwp. Can you give an example of how to use StreamMediaInput to provide the sdp content? – Jamie9057 Dec 21 '21 at 09:12
  • OK, I wasn't aware of that syntax. As a rule of thumb, always check the logs generated by the app. See the troubleshooting section to see how to enable them – cube45 Dec 22 '21 at 05:26
  • Don't think you've answered this but how do i use a StreamMediaInput to provide the sdp content? – Jamie9057 Dec 23 '21 at 01:23
  • put your content in a MemoryStream, wrap it in a StreamMediaInput and pass it to the Play call – cube45 Dec 23 '21 at 05:07