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