Skip to content

Session State

app.domain.session.session_state

View source code

Session view_state management — playback, settings, and frame data.

See Also

Layer: Domain. Context: Defines application concepts independently of UI and infrastructure implementations.

SessionState dataclass

Manages runtime view_state for a single video processing session.

ATTRIBUTE DESCRIPTION
s_id

Session identifier for the open video.

TYPE: SessionId

metadata

Video file metadata such as size, FPS, and frame count.

TYPE: VideoMetadata

playback

Current playback view_state for the session.

TYPE: PlaybackState

settings

User-configurable processing settings.

TYPE: ProcessingSettings

current_frame_data

Currently displayed RGB frame cache.

TYPE: RGBFrame | None

next_annotation_id

Counter used for manual detection IDs.

TYPE: int

Note

This class is a runtime data container rather than a business-logic object. Bounding detection data lives separately in SessionDataStore, while playback, settings, and the current frame cache are kept here for fast UI access. Instances are created when a session opens, updated during playback and settings changes, and cleared when the session ends.

Layer: Domain. Context: Represents application concepts without UI or infrastructure dependencies.

current_frame_data: RGBFrame | None = field(default=None, repr=False) class-attribute instance-attribute

is_at_last_frame: bool property

Return whether playback is at or beyond the final video frame.

RETURNS DESCRIPTION
bool

True when no frames are reported or the current index reaches the last frame.

is_playing_video: bool property

Return whether video playback is active.

RETURNS DESCRIPTION
bool

True while playback is active; otherwise False.

metadata: VideoMetadata instance-attribute

next_annotation_id: int = 1 class-attribute instance-attribute

playback: PlaybackState = field(default_factory=PlaybackState) class-attribute instance-attribute

s_id: SessionId instance-attribute

settings: ProcessingSettings = field(default_factory=ProcessingSettings) class-attribute instance-attribute

settings_view_model: SessionSettingsViewModel property

Return the session settings as a view model.

RETURNS DESCRIPTION
SessionSettingsViewModel

View model built from the current processing settings.

__init__(s_id: SessionId, metadata: VideoMetadata, playback: PlaybackState = PlaybackState(), settings: ProcessingSettings = ProcessingSettings(), current_frame_data: RGBFrame | None = None, next_annotation_id: int = 1) -> None

update_current_frame_data_and_index(idx: int, frame_data: RGBFrame) -> None

Update current frame data and index.

PARAMETER DESCRIPTION
idx

Zero-based index of the displayed frame.

TYPE: int

frame_data

RGB pixel data for the displayed frame.

TYPE: RGBFrame