简体   繁体   English

使用 LibVLCSharp 和 SDP 文件在 WPF 中进行直播

[英]Livestreaming in WPF using LibVLCSharp and SDP file

I am able to open an sdp file in VLC to view a udp livestream from gstreamer.我可以在 VLC 中打开一个 sdp 文件以查看来自 gstreamer 的 udp 直播。 I would like to do the same in WPF.我想在 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). 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以下)。

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") .我确定我的代码的 rest 是正确的,因为我可以通过用new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")替换 sdp 字符串来播放 Big Buck Bunny 视频new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4") .

How do I correctly input the sdp file into LibVLCSharp media?如何将 sdp 文件正确输入到 LibVLCSharp 媒体中?

Are you sure the url syntax is correct?您确定 url 语法正确吗? how would you do with VLC?你会如何处理 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.我宁愿在 url 中有 .sdp 文件路径(请参阅有关播放文件的其他示例)或使用 StreamMediaInput 来提供 sdp 内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM