pub struct Player {
pub attrs: Attrs,
pub last_frame_time: Option<Instant>,
}Expand description
Playback state manager (does NOT own Project)
Player manages playback state only. Project is passed by reference to methods that need it. PlayaApp owns the single Project instance.
Attrs keys:
active_comp: Uuid (optional, missing key = None)previous_comp_history: List(most recent last) is_playing: Boolfps_base: Float (persistent base FPS)fps_play: Float (temporary playback FPS)loop_enabled: Boolplay_direction: Float (1.0 forward, -1.0 backward)selected_seq_idx: Optionstored as Int (missing key = None)
Fields§
§attrs: AttrsAll serializable player state
last_frame_time: Option<Instant>Last frame timestamp (runtime-only, not serializable)
Implementations§
Source§impl Player
impl Player
Sourcepub fn attach_schema(&mut self)
pub fn attach_schema(&mut self)
Attach schema after deserialization
Sourcepub fn active_comp(&self) -> Option<Uuid>
pub fn active_comp(&self) -> Option<Uuid>
Get active comp UUID
Sourcepub fn previous_comp_history(&self) -> Vec<Uuid>
pub fn previous_comp_history(&self) -> Vec<Uuid>
Get previous comp history (most recent last)
Sourcepub fn take_previous_comp(&mut self) -> Option<Uuid>
pub fn take_previous_comp(&mut self) -> Option<Uuid>
Pop the last previous comp (for U key navigation back)
Sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
Check if playing
Sourcepub fn set_is_playing(&mut self, playing: bool)
pub fn set_is_playing(&mut self, playing: bool)
Set playing state
Sourcepub fn set_fps_base(&mut self, fps: f32)
pub fn set_fps_base(&mut self, fps: f32)
Set base FPS
Sourcepub fn set_fps_play(&mut self, fps: f32)
pub fn set_fps_play(&mut self, fps: f32)
Set playback FPS
Sourcepub fn loop_enabled(&self) -> bool
pub fn loop_enabled(&self) -> bool
Check if loop is enabled
Sourcepub fn set_loop_enabled(&mut self, enabled: bool)
pub fn set_loop_enabled(&mut self, enabled: bool)
Set loop enabled
Sourcepub fn play_direction(&self) -> f32
pub fn play_direction(&self) -> f32
Get play direction (1.0 forward, -1.0 backward)
Sourcepub fn selected_seq_idx(&self) -> Option<usize>
pub fn selected_seq_idx(&self) -> Option<usize>
Get selected sequence index
Sourcepub fn set_selected_seq_idx(&mut self, idx: Option<usize>)
pub fn set_selected_seq_idx(&mut self, idx: Option<usize>)
Set selected sequence index
Sourcepub fn total_frames(&self, project: &Project) -> i32
pub fn total_frames(&self, project: &Project) -> i32
Get total frames of active node (work area frame count)
Sourcepub fn play_range(&self, project: &Project) -> (i32, i32)
pub fn play_range(&self, project: &Project) -> (i32, i32)
Get current play range of active node (start, end), or (0, 0) if none.
Sourcepub fn set_play_range(&mut self, start: i32, end: i32, project: &mut Project)
pub fn set_play_range(&mut self, start: i32, end: i32, project: &mut Project)
Set play range of active comp in global comp frame indices (inclusive).
Sourcepub fn current_frame(&self, project: &Project) -> i32
pub fn current_frame(&self, project: &Project) -> i32
Get current frame index from active comp
Sourcepub fn get_current_frame(&self, project: &Project) -> Option<Frame>
pub fn get_current_frame(&self, project: &Project) -> Option<Frame>
Get current frame as owned Frame (Composed) Uses GPU compositor (main thread only)
Sourcepub fn set_active_comp(
&mut self,
comp_uuid: Option<Uuid>,
project: &mut Project,
)
pub fn set_active_comp( &mut self, comp_uuid: Option<Uuid>, project: &mut Project, )
Switch to a different composition by UUID.
Updates active_comp and emits CurrentFrameChanged event. Stops playback during transition.
Selection reset: Resets project selection to just this comp. Prevents multi-selection accumulation when adding new clips or switching between comps (e.g., double-click on timeline layer).
Sourcepub fn update(&mut self, project: &mut Project) -> Option<i32>
pub fn update(&mut self, project: &mut Project) -> Option<i32>
Update playback state. Returns Some(new_frame) if frame changed, None otherwise. Caller should emit SetFrameEvent for unified frame change handling.
Sourcepub fn set_frame(&mut self, frame: i32, project: &mut Project)
pub fn set_frame(&mut self, frame: i32, project: &mut Project)
Set current frame (emits CompEvent::CurrentFrameChanged).
Clamps to full comp timeline [comp.start..=comp.end], not play_range, so scrubbing/timeline can move outside work area while playback still respects play_range.
Sourcepub fn step(&mut self, count: i32, project: &mut Project)
pub fn step(&mut self, count: i32, project: &mut Project)
Step by N frames (positive = forward, negative = backward) Respects play range and loop_enabled setting
Sourcepub fn jog_forward(&mut self)
pub fn jog_forward(&mut self)
Jog forward (L, >, ArrowRight)
Sourcepub fn jog_backward(&mut self)
pub fn jog_backward(&mut self)
Jog backward (J, <, ArrowLeft)
Sourcepub fn increase_fps_base(&mut self)
pub fn increase_fps_base(&mut self)
Increase base FPS to next preset (-/+ keys, Keypad)
Sourcepub fn decrease_fps_base(&mut self)
pub fn decrease_fps_base(&mut self)
Decrease base FPS to previous preset (-/+ keys, Keypad)
Sourcepub fn reset_settings(&mut self)
pub fn reset_settings(&mut self)
Reset settings
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Player
impl<'de> Deserialize<'de> for Player
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !Freeze for Player
impl RefUnwindSafe for Player
impl Send for Player
impl Sync for Player
impl Unpin for Player
impl UnwindSafe for Player
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().