The wpf application for broadcasting video with a delay of 15 seconds

I have a WPF application for broadcasting videos using Microsoft.expression.encoder and framework 4.0, but during the broadcast I got a delay of 15 seconds. Is there any suggestion to reduce the delay during the broadcast.

below is the code

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());
    }

}

I use MediaElement to display a webcam on both my server and client systems.

on the client side

 try
            {

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

Unfortunately, there is no solution (at least since January 2011). According to Microsoft:

" , , 5-20 , , , Silverlight ".

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

+2

, PreviewWindow MediaElement, . PreviewWindow - WinForms, WPF.

XAML:

<WindowsFormsHost>
    <wf:Panel x:Name="PreviewPanel" />
</WindowsFormsHost>

:

var previewWindow = new PreviewWindow(new HandleRef(this.PreviewPanel, this.PreviewPanel.Handle));
_deviceSource.PreviewWindow = previewWindow;
// ..
_job.ActivateSource(_deviceSource);
0

All Articles