gpt4 book ai didi

c# - 用于延迟 15 秒播放视频的 wpf 应用程序

转载 作者:太空狗 更新时间:2023-10-29 23:40:35 28 4
gpt4 key购买 nike

我有一个使用 Microsoft.expression.encoder 和 framework 4.0 播放视频的 WPF 应用程序,但是我在播放时有 15 秒的延迟。有没有减少播放时延迟的建议。

下面是代码

using Microsoft.Expression.Encoder.Live; 
using Microsoft.Expression.Encoder;

private void button1_Click(object sender, RoutedEventArgs e)
{
try
{
EncoderDevice video = null;
EncoderDevice audio = null;
GetSelectedVideoAndAudioDevices(out video, out audio);
StopJob();

if (video == null)
{
return;
}

StopJob();
_job = new LiveJob();

if (video != null && audio != null)
{
//StopJob();
_deviceSource = null;
_deviceSource = _job.AddDeviceSource(video, audio);
_job.ActivateSource(_deviceSource);

// Finds and applys a smooth streaming preset
//_job.ApplyPreset(LivePresets.VC1HighSpeedBroadband4x3);

// Creates the publishing format for the job
PullBroadcastPublishFormat format = new PullBroadcastPublishFormat();
format.BroadcastPort = 9090;
format.MaximumNumberOfConnections = 50;

// Adds the publishing format to the job
_job.PublishFormats.Add(format);

// Starts encoding
_job.StartEncoding();
}
//webCamCtrl.StartCapture();
}
catch (Exception ex)
{
WriteLogFile(this.GetType().Name, "button1_Click", ex.Message.ToString());
}

}

我正在使用 MediaElement 在我的服务器和客户端系统上显示网络摄像头。

在客户端

 try
{

theMainWindow.getServerIPAddress();
IP = theMainWindow.machineIP;
MediaElement1.Source = new Uri("http://" + IP + ":9090/");
}
catch (Exception ex)
{
}

最佳答案

很遗憾,没有解决方案(至少截至 2011 年 1 月)。据微软称:

“我们在编码过程中增加了几秒钟的延迟,然后在服务器级别进行缓存,这可能会再增加 5-20 秒,最后 Silverlight 也会缓存另外几秒钟的延迟。”

http://social.expression.microsoft.com/Forums/is/encoder/thread/898b2659-c0d5-4c84-8fba-225f58806f5d

关于c# - 用于延迟 15 秒播放视频的 wpf 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10990427/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com