wpf延迟播放视频的申请

时间:2012-06-05 04:49:48

标签: wpf .net-4.0

我有一个用于使用表达式编码器4和框架4.0播放视频的wpf应用程序,但是我在播放时有15秒的延迟。是否有任何建议可以减少广播时的延迟。

下面是代码

private void button1_Click(object sender,RoutedEventArgs e)         {             尝试             {                 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());
        }

    }

0 个答案:

没有答案