如何使用 C# 控制台应用程序在 VLC 中流式传输 RTSP 时循环播放视频

问题描述

这是我正在使用的代码,但即使在代码中使用 :input-repeat=65535 后也无法循环播放视频。我需要循环播放视频,而无需对 vlc 播放器进行任何更改。

string url = "https://demo.mp4";
int lastIndex = url.LastIndexOf("/");
string Path_1 = url.Substring(lastIndex + 1); //filename
string savePath = @"D:" + Path_1;
WebClient client = new WebClient();
client.DownloadFile(url,savePath);
FileInfo file = new FileInfo(@"D:\Demo\" + Path_1);
var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var libDirectory = new DirectoryInfo(Path.Combine(currentDirectory,"libvlc",IntPtr.Size == 4 ? "win-x86" : "win-x64"));

using (var mediaPlayer = new Vlc.DotNet.Core.VlcmediaPlayer(libDirectory))
 {
   var mediaOptions = new[]
  {   ":sout=#gather:rtp{sdp=rtsp://127.0.0.1:8022/test}",":sout-keep",":network-caching = 150",":clock-jitter=0",":clock-synchro=0",":input-repeat=65535"};                 
       mediaPlayer.SetMedia(file,mediaOptions);
       mediaPlayer.Play();
       Console.WriteLine("Streaming on rtsp://127.0.0.1:8022/test");
       Console.WriteLine("Press any key to exit");
       Console.ReadKey();
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...