如何消除流式应用程序中的延迟

How to remove a delay in a streaming App

我开发了一个流媒体客户端应用程序,它必须重现摄像头拍摄的图像。我的问题是我正在以 2 秒的延迟观看流媒体。我不知道如何从我的代码中控制它。你能帮我吗?这是我的代码:

 public Form1()
    {
        InitializeComponent();


        vlcControl1 = new Vlc.DotNet.Forms.VlcControl();

        this.vlcControl1.Location = new System.Drawing.Point(225, 65);
        this.vlcControl1.Name = "vlcControl1";
        this.vlcControl1.Size = new System.Drawing.Size(900, 700);
        this.vlcControl1.BackColor = System.Drawing.Color.Black;
        this.vlcControl1.Name = "vlcControl2";
        this.vlcControl1.Spu = -1;
        this.vlcControl1.TabIndex = 0;
        this.vlcControl1.Text = "vlcControl2";
        this.vlcControl1.VlcMediaplayerOptions = null;

        vlcControl1.VlcLibDirectory = new System.IO.DirectoryInfo(ConfigurationManager.AppSettings.Get("pathVLC64").ToString());

        this.Controls.Add(this.vlcControl1);

        ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).EndInit();

    }
 string uri = ConfigurationManager.AppSettings.Get("urlVideo").ToString();
string[] options = { ":network-caching=1000" };

        vlcControl1.Play(new Uri(uri), options);

}

我试过更改网络缓存参数,但它不起作用。 非常感谢

嗯,既然你看起来只懂基础知识,不会包括代码,我要做的是:

  1. 我将播放器 #1 设置为不同的 SPU
  2. 使用新线程与另一个 class 同步开始。
  3. 将媒体加载到两个播放器并向两个线程发送同步命令。

这样两个播放器的播放开始同步。此外,通过这种方式您可以延迟或设置 Thread.Sleep(2000);如果需要进一步同步。

希望这会有所帮助,如果您需要一些代码示例,只需询问就可以写一些,但是包括主应用程序 -> 播放器 #1 -> 新线程 class -> 播放器 #2 函数是相当多的代码粘贴。