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 SetupJob() { // Sets the audio devices to the collection. Adds a null at the beginning for user to select no device AudioDevices = new ObservableCollection <EncoderDevice>(EncoderDevices.FindDevices(EncoderDeviceType.Audio)); AudioDevices.Insert(0, null); // Gets all the video devices and sets the screen source. EncoderDevice Video = null; Collection <EncoderDevice> videoSources = EncoderDevices.FindDevices(EncoderDeviceType.Video); foreach (EncoderDevice dev in videoSources) { if (dev.Name.Contains("Screen Capture Source")) { Video = dev; } } // Creats the source Source = Job.AddDeviceSource(Video, null); // Activates sources and sets preset to job Job.ActivateSource(Source); Job.ApplyPreset(LivePresets.VC1HighSpeedBroadband4x3); }
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(); }
public void StartCapture() { if (!IsCapturing) { job = new LiveJob(); dvs = job.AddDeviceSource(SelectedVideoDevice, SelectedAudioDevice); job.ActivateSource(dvs); job.ApplyPreset(LivePresets.VC1HighSpeedBroadband4x3); double epoch = GetUnixEpoch(DateTime.UtcNow); string timestamp = epoch.ToString(); VideoFileName = string.Format(VIDEO_FILE, timestamp); FileArchivePublishFormat fileOut = new FileArchivePublishFormat(); fileOut.OutputFileName = Path.Combine(FileLocationUtility.GetVideoFolderLoctation(), VideoFileName); job.PublishFormats.Add(fileOut); job.StartEncoding(); started = DateTime.UtcNow; IsCapturing = true; } }