public override void Execute() { var isStarted = false; // sleep to make sure the pausing is complete while (Store.Data.Record.OutputAndEncoders.obsOutput != null) { Thread.Sleep(100); } var baseRecordingParameters = new BaseRecordingParameters { CropTop = CropTop, CropRight = CropRight, CropLeft = CropLeft, CropBottom = CropBottom, FrameRate = FrameRate, OutputWidth = OutputWidth, OutputHeight = OutputHeight, CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight, VideoOutputFolder = Store.Data.Record.VideoOutputFolder, ScreenX = ScreenX, ScreenY = ScreenY }; IBaseRecordingService service = RecordingFactory.Make(Store.Data.Webcam.IsWebcamOnly, baseRecordingParameters); isStarted = service.StartRecording(); EmitService.EmitStatusResponse(AvailableCommand.ResumeRecording, isStarted); }
public override void Execute() { try { Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(() => { Store.Data.Webcam.Window.Left = Left.Value; Store.Data.Webcam.Window.Top = Top.Value; Store.Data.Webcam.Window.Show(Width, Height); if (!Store.Data.Webcam.IsWebcamEnabled) { Store.Data.Webcam.Window.SetWebcam(Store.Data.Webcam.DefaultWebcam); Store.Data.Webcam.Window.mainBorder.Visibility = Visibility.Visible; } EmitService.EmitEnableWebcamResponse(AvailableCommand.EnableWebcamOnly, Store.Data.Webcam.Window.selectedWebcam.value, true); })); Store.Data.Webcam.IsWebcamEnabled = true; Store.Data.Webcam.IsWebcamOnly = true; } catch (Exception ex) { //EmitService.EmitEnableWebcamResponse(AvailableCommand.EnableWebcamOnly, ex.Message, false, Constants.Webcam.ErrorMessages.EnableWebcamOnlyFailed); throw ex; } }
protected override void OutputStopped() { VideoMergeOutput output = new VideoMerge(Store.Data.Record.RecordedFiles).CombineAndWrite(); Store.Data.ResetRecordModule(); EmitService.EmitStopRecordingStatusResponse(output.FileOutputPath, Store.Data.Record.LastVideoName, output.IsSuccessful, output.MergeFailureReason); }
public override void Execute() { var obsAudioDevices = AudioService.GetAudioOutputDevices(); var audioDeviceList = new AudioDeviceList(); obsAudioDevices.ForEach(x => audioDeviceList.Add(x)); EmitService.EmitAudioOutputDevices(audioDeviceList); }
public override void Execute() { Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(() => { Store.Data.Webcam.Window.EnumerateAndSetWebcams(); EmitService.EmitWebcamDevices(new WebcamDeviceList { Devices = Store.Data.Webcam.Webcams }); })); }
public override void Execute() { if (Store.Data.Record.IsPausing) { return; } Store.Data.Record.IsPausing = true; this.StopOutput(); EmitService.EmitStatusResponse(AvailableCommand.PauseRecording, true, "Paused"); }
public override void Execute() { while (Store.Data.Record.OutputAndEncoders.obsOutput != null && Store.Data.Record.OutputAndEncoders.obsOutput.Active) { Thread.Sleep(100); } FileInfo lastFile = Store.Data.Record.RecordedFiles.Last(); lastFile.Delete(); Store.Data.Record.RecordedFiles.Remove(lastFile); EmitService.EmitDeleteLastSectionResponse(Store.Data.Record.RecordedFiles.Count, true); }
public override void Execute() { var properties = new WebcamWindowProperties() { IsEnabled = Store.Data.Webcam.IsWebcamEnabled, BorderSize = 10 }; if (Store.Data.Webcam.IsWebcamEnabled && Store.Data.Webcam.Window != null) { Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(() => { properties.Left = Store.Data.Webcam.Window.Left; properties.Top = Store.Data.Webcam.Window.Top; properties.Height = Store.Data.Webcam.Window.Height; properties.Width = Store.Data.Webcam.Window.Width; properties.BorderSize = Store.Data.Webcam.Window.BorderSize; })); } EmitService.EmitWebcamWindowProperties(properties); }
public override void Execute() { var baseRecordingParameters = new BaseRecordingParameters { CropTop = CropTop, CropRight = CropRight, CropLeft = CropLeft, CropBottom = CropBottom, FrameRate = FrameRate, OutputWidth = OutputWidth, OutputHeight = OutputHeight, CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight, VideoOutputFolder = VideoOutputFolder, ScreenX = ScreenX, ScreenY = ScreenY }; IBaseRecordingService service = RecordingFactory.Make(Store.Data.Webcam.IsWebcamOnly, baseRecordingParameters); var isStarted = service.StartRecording(); EmitService.EmitStatusResponse(AvailableCommand.StartRecording, isStarted); }
public override void Execute() { if (WebcamValue == Store.Data.Webcam.ActiveWebcamValue) { return; } Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(() => { if (!Left.HasValue || !Top.HasValue) { Store.Data.Webcam.Window.WindowStartupLocation = WindowStartupLocation.CenterScreen; } else { Store.Data.Webcam.Window.Left = Left.Value; Store.Data.Webcam.Window.Top = Top.Value; } Store.Data.Webcam.Window.Show(Width, Height); var webcam = WebcamService.GetWebcam(WebcamValue); if (webcam == null) { webcam = Store.Data.Webcam.Webcams.FirstOrDefault(); } Store.Data.Webcam.Window.SetWebcam(webcam); Store.Data.Webcam.Window.mainBorder.Visibility = Visibility.Visible; EmitService.EmitEnableWebcamResponse(AvailableCommand.EnableWebcam, Store.Data.Webcam.Window.selectedWebcam.value, true); })); Store.Data.Webcam.IsWebcamEnabled = true; }
public override void Execute() { if (!Store.Data.Obs.IsObsStarted) { if (!Obs.Startup("en-US")) { // todo: if any exceptions are thrown in this app, we need to bubble it all up to a single terminate code so consuming apps know that it shut down throw new ApplicationException("Startup failed."); } Loggers.OBSLogger.Trace("libobs version: " + Obs.GetVersion()); // forward OBS logging messages to debugger Obs.SetLogHandler((lvl, msg, p) => { Debug.WriteLine(msg); Loggers.OBSLogger.Trace(msg); }); AudioService.ResetAudioInfo(); } VideoService.ResetVideoInfo(new ResetVideoInfoParameters { CropTop = CropTop, CropRight = CropRight, CropLeft = CropLeft, CropBottom = CropBottom, FrameRate = FrameRate, OutputWidth = OutputWidth, OutputHeight = OutputHeight, CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight, ScreenX = ScreenX, ScreenY = ScreenY }); if (!Store.Data.Obs.IsObsStarted) { Obs.LoadAllModules(); Store.Data.Obs.Presentation = new Presentation(); Store.Data.Obs.Presentation.AddScene("Main"); Store.Data.Obs.Presentation.AddScene("Webcam"); Store.Data.Obs.Presentation.SetScene(Store.Data.Obs.MainScene); Store.Data.Display.DisplaySource = Store.Data.Obs.Presentation.CreateSource("monitor_capture", "Monitor Capture Source"); Store.Data.Obs.Presentation.AddSource(Store.Data.Display.DisplaySource); Store.Data.Display.DisplayItem = Store.Data.Obs.Presentation.CreateItem(Store.Data.Display.DisplaySource); Store.Data.Display.DisplayItem.Name = "Monitor Capture SceneItem"; Rectangle activeScreenBounds = ScreenHelper.GetScreen(ScreenX, ScreenY).Bounds; Store.Data.Display.DisplayItem.SetBounds(new Vector2(activeScreenBounds.Width, activeScreenBounds.Height), ObsBoundsType.None, ObsAlignment.Top); // this should always be the screen's resolution Store.Data.Obs.MainScene.Items.Add(Store.Data.Display.DisplayItem); Thread webcamWindowThread = new Thread(() => { Store.Data.Webcam.Window = new WebcamWindow(); Store.Data.App.ApplicationInstance = new Application(); Store.Data.App.ApplicationInstance.Run(Store.Data.Webcam.Window); }); webcamWindowThread.Name = Constants.Webcam.Settings.WebcamWindowThreadName; webcamWindowThread.SetApartmentState(ApartmentState.STA); webcamWindowThread.Start(); var usedAudioInputId = AudioService.SetAudioInput(this.SavedAudioInputId); var usedAudioOutputId = AudioService.SetAudioOutput(this.SavedAudioOutputId); Store.Data.Obs.Presentation.SetItem(0); Store.Data.Obs.Presentation.SetSource(0); // wait until the window is initialized before emitting a response while (Store.Data.Webcam.Window == null) { Thread.Sleep(100); } EmitService.EmitInitializeResponse(new InitializeResponse { IsSuccessful = true, SetAudioInputDevice = usedAudioInputId, SetAudioOutputDevice = usedAudioOutputId }); } MagnitudeService.Setup(); Store.Data.Obs.IsObsStarted = true; }
protected override void OutputStopped() { VideoService.CancelRecording(); EmitService.EmitStatusResponse(AvailableCommand.CancelRecording, true); }