C# wpf在视频广播中的应用

C# wpf在视频广播中的应用,c#,wpf,mediaelement,expression-encoder,broadcasting,C#,Wpf,Mediaelement,Expression Encoder,Broadcasting,我有一个WPF应用程序,用于使用Microsoft.expression.encoder和framework 4.0播放视频,但我在播放时延迟了15秒。是否有任何建议可以减少播放时的延迟 下面是代码 using Microsoft.Expression.Encoder.Live; using Microsoft.Expression.Encoder; private void button1_Click(object sender, RoutedEventArgs e) { try

我有一个WPF应用程序,用于使用Microsoft.expression.encoder和framework 4.0播放视频,但我在播放时延迟了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)
            {
            }

您可以使用IIS平滑流来开始播放较低比特率的内容,并在客户端缓冲区填满时逐渐增加。Silverlight内置了对平滑流的支持,并且可以在WPF中手动实现(至少在理论上)

是否有什么特别的事情阻止您在客户端使用SL?

如果您运行带宽测试(例如),您的上载和下载速度是多少?