private void Broadcast_Click(object sender, EventArgs e) { EncoderDevice video = null; EncoderDevice audio = null; GetSelectedVideoAndAudioDevices(out video, out audio); StopJob(); if (video == null) { return; } _job = new LiveJob(); _deviceSource = _job.AddDeviceSource(video, audio); _job.ActivateSource(_deviceSource); // Finds and applys a smooth streaming preset _job.ApplyPreset(LivePresets.VC1256kDSL16x9); // Creates the publishing format for the job PullBroadcastPublishFormat format = new PullBroadcastPublishFormat(); format.BroadcastPort = 8080; format.MaximumNumberOfConnections = 2; // Adds the publishing format to the job _job.PublishFormats.Add(format); // Starts encoding _job.StartEncoding(); toolStripStatusLabel1.Text = "Broadcast started on localhost at port 8080, run WpfShowBroadcast.exe now to see it"; }
private void Broadcast_Click(object sender, EventArgs e) { EncoderDevice video = null; EncoderDevice audio = null; GetSelectedVideoAndAudioDevices(out video, out audio); StopJob(); if (video == null) { return; } _job = new LiveJob(); _deviceSource = _job.AddDeviceSource(video, audio); _job.ActivateSource(_deviceSource); // Finds and applys a smooth streaming preset _job.ApplyPreset(LivePresets.VC1256kDSL16x9); // Creates the publishing format for the job PullBroadcastPublishFormat format = new PullBroadcastPublishFormat(); format.BroadcastPort = 8080; format.MaximumNumberOfConnections = 2; // Adds the publishing format to the job _job.PublishFormats.Add(format); // Starts encoding _job.StartEncoding(); toolStripStatusLabel1.Text = "Broadcast started on localhost at port 8080, run WpfShowBroadcast.exe now to see it"; }
public void GetVideo() { var listVideoDevices = new List <EncoderDevice>(); var listAudioDevices = new List <EncoderDevice>(); foreach (var edv in EncoderDevices.FindDevices(EncoderDeviceType.Video)) { listVideoDevices.Add(edv); } foreach (var edv in EncoderDevices.FindDevices(EncoderDeviceType.Audio)) { listAudioDevices.Add(edv); } var job = new LiveJob(); var deviceSource = job.AddDeviceSource(listVideoDevices[0], listAudioDevices[0]); job.ActivateSource(deviceSource); job.ApplyPreset(LivePresets.VC1HighSpeedBroadband4x3); PullBroadcastPublishFormat format = new PullBroadcastPublishFormat(); format.BroadcastPort = 5001; format.MaximumNumberOfConnections = 1; job.PublishFormats.Add(format); job.StartEncoding(); }
/// <summary> /// Create a stream flux of the selected webcam throught the specified port. /// </summary> /// <param name="port">Port of the streaming flux (ex: "8080")</param> /// <param name="maxNbConnections">Number maximum of connections</param> /// <param name="qualityFormat">Define the quality of the flux (use "LivePresets" enum)</param> /// <returns>Return TRUE if the streaming start with success</returns> public bool StartStreaming(int port,int maxNbConnections,Preset qualityFormat) { if (port > 0 && maxNbConnections > 0 && qualityFormat !=null) { PullBroadcastPublishFormat = new PullBroadcastPublishFormat(); PullBroadcastPublishFormat.BroadcastPort = port; PullBroadcastPublishFormat.MaximumNumberOfConnections = maxNbConnections; LiveJob.ApplyPreset(qualityFormat); LiveJob.PublishFormats.Add(PullBroadcastPublishFormat); LiveJob.StartEncoding(); return true; } return false; }