mini_arcade_core.runtime.capture.capture_service ================================================ .. py:module:: mini_arcade_core.runtime.capture.capture_service .. autoapi-nested-parse:: Capture service managing screenshots and replays. Classes ------- .. autoapisummary:: mini_arcade_core.runtime.capture.capture_service.CaptureService Module Contents --------------- .. py:class:: CaptureService(backend: mini_arcade_core.backend.Backend, *, screenshots: Optional[mini_arcade_core.runtime.capture.screenshot_capturer.ScreenshotCapturer] = None, replay_recorder: Optional[mini_arcade_core.runtime.capture.replay.ReplayRecorder] = None, replay_player: Optional[mini_arcade_core.runtime.capture.replay.ReplayPlayer] = None, settings: Optional[mini_arcade_core.runtime.capture.capture_settings.CaptureSettings] = None) Bases: :py:obj:`mini_arcade_core.runtime.capture.capture_service_protocol.CaptureServicePort` Owns: - screenshots (delegated) - replay recording (InputFrame stream) - replay playback (feeds InputFrames) - (later) video recording .. py:attribute:: backend .. py:attribute:: settings .. py:attribute:: screenshots .. py:attribute:: replay_recorder .. py:attribute:: replay_player .. py:attribute:: video .. py:attribute:: encoder .. py:method:: screenshot(label: str | None = None) -> str Take a screenshot with an optional label. :param label: Optional label for the screenshot. :type label: str | None :return: Path to the saved screenshot. :rtype: str .. py:method:: screenshot_sim(run_id: str, frame_index: int, label: str = 'frame') -> str Take a screenshot for a simulation frame. :param run_id: Unique identifier for the simulation run. :type run_id: str :param frame_index: Index of the frame in the simulation. :type frame_index: int :param label: Label for the screenshot. :type label: str :return: Path to the saved screenshot. :rtype: str .. py:property:: replay_playing :type: bool Check if a replay is currently being played back. :return: True if a replay is active, False otherwise. :rtype: bool .. py:property:: replay_recording :type: bool Check if a replay is currently being recorded. :return: True if recording is active, False otherwise. :rtype: bool .. py:method:: start_replay_record(*, filename: str, header: mini_arcade_core.runtime.capture.replay_format.ReplayHeader) Start recording a replay. :param filename: The filename to save the replay to. :type filename: str :param header: The header information for the replay. :type header: ReplayHeader .. py:method:: stop_replay_record() Stop recording the current replay. .. py:method:: record_input(frame: mini_arcade_core.runtime.input_frame.InputFrame) Record an input frame to the replay. :param frame: The input frame to record. :type frame: InputFrame .. py:method:: start_replay_play(filename: str) -> mini_arcade_core.runtime.capture.replay_format.ReplayHeader Start playing back a replay. :param filename: The filename of the replay to play. :type filename: str :return: The header information of the replay. :rtype: ReplayHeader .. py:method:: stop_replay_play() Stop playing back the current replay. .. py:method:: next_replay_input() -> mini_arcade_core.runtime.input_frame.InputFrame Get the next input frame from the replay. :return: The next input frame. :rtype: InputFrame .. py:property:: video_recording :type: bool Check if video recording is currently active. :return: True if video recording is active, False otherwise. :rtype: bool .. py:method:: start_video_record(*, fps: int = 60, capture_fps: int = 15) -> pathlib.Path Start recording video. :param fps: Frames per second for the output video. :type fps: int :param capture_fps: Frames per second to capture from the engine. :type capture_fps: int :return: Path to the directory where video frames are saved. :rtype: Path .. py:method:: stop_video_record() Stop recording video. .. py:method:: record_video_frame(*, frame_index: int) Call this once per engine frame (from EngineRunner) AFTER render.