Timeline API¶
Manage timeline’s Play State and Volume controls.
Also convert current frame of a clip to its frame number relative to the current timeline sequence and vice versa.
- class rpa.api.timeline_api.TimelineApi(*args: Any, **kwargs: Any)[source]
Bases:
QObject- SIG_FRAME_CHANGED
alias of
int
- SIG_PLAY_STATUS_CHANGED
alias of
bool
- property delegate_mngr
- enable_audio_scrubbing(state) bool[source]
Set on/off to audio scrubbing mode
- Parameters:
state (bool) – on/off flag
- Returns:
True if set False otherwise
- Return type:
(bool)
- get_clip_frames(frames: List[int] | None = None) List[Tuple[str, int, int]][source]
Get the frames relative to the clips in the timeline corresponding to the given timeline sequence frames. If frames are not given, then all the ids of the clips with their respective clip frames and local frames will be returned.
- Kwargs:
frames(List[int]): List of timeline sequence frames
- Returns:
List of tuples with clip_id, clip_frame, and local_frame associated with the given sequence frames.
- Return type:
List[Tuple(str, int, int)]
Example of how the returned list will look like,
[ ("clip_id_1", 1001, 1), ("clip_id_1", 1002, 2), ("clip_id_1", 1002, 3), ("clip_id_2", 1005, 1), ("clip_id_2", 1007, 2), ("clip_id_2", 1008, 3), ("clip_id_3", 1002, 1), ("clip_id_3", 1003, 2) ]
- get_current_frame() int[source]
Get the current frame of the timeline. If no current clip is present then 0 is returned.
Note that the frame number returned is relative to the timeline sequence and not relative to individual clips.
- Returns:
Current frame
- Return type:
(int)
- get_frame_range() Tuple[int, int][source]
Get the start and end frame of the timeline. If no current clip is present then 0 is returned for both start and end.
Note that the frame numbers returned are relative to the timeline sequence and not relative to individual clips.
- Returns:
Start and end frames of the timeline.
- Return type:
(Tuple[int, int])
- get_playback_mode() int[source]
Get the current playback mode The default playback mode is set to: 0 - Playback Repeat The returned playback mode is one of the following: 0 - Playback Repeat (Loop) 1 - Playback Once 2 - Playback Swing (PingPong)
- Returns:
An integer representing the current playback mode
- get_playing_state()[source]
Returns the current playing state
- Returns:
Two bools representing is-playing and is-forward states
- get_seq_frames(clip_id: str, frames: List[int] | None = None) List[Tuple[int, List[int]]][source]
Get the frames relative to the current timeline sequence that corresponds to the given clip frames. If frames are not given, then all the frames in the current timeline sequence will be returned.
- Parameters:
clip_id (str) – Id of clip in timeline whose frames need to be converted into timeline sequence frames.
- Kwargs:
frames(List[int]): Clip frames relative to the given clip.
- Returns:
List of tuples in which first element in the tuple is the clip frame, and the second element is a list of sequence frames associated with the clip frame
- Return type:
List[Tuple[int, List[int]]]
Examples of how the returned list will look like:
[(1001, [1]), (1002, [2]), (1003, [3]), (1004, [4]), (1005, [5]), (1006, [6]), (1007, [7])] [(1001, [8]), (1002, [9,10,11,12]), (1004, [13,14]), (1005, [15])]
- get_volume()[source]
Get current volume
- Returns:
int value in [0,100] range
- goto_frame(frame: int) bool[source]
Go to the specified frame.
Note that the given frame number must be relative to the timeline sequence and not relative to individual clips.
- Parameters:
frame (int) – Frame in timeline sequence
- Returns:
True if set False otherwise
- Return type:
(bool)
- is_audio_scrubbing_enabled()[source]
Get current audio scrubbing state
- Returns:
bool representing on or off scrubbing state
- is_mute()[source]
Get current state of mute on audio
- Returns:
bool - if True audio is muted, else not muted
- set_mute(state: bool)[source]
Set/unset audio to mute
- Parameters:
state (bool) – desired state of mute
- Returns:
True if success False otherwise
- Return type:
(bool)
- set_playback_mode(mode: int)[source]
Set the playback mode of the current session 0 - Playback Repeat (Loop) 1 - Playback Once 2 - Playback Swing (PingPong)
- Parameters:
mode (int) – An integer that represents the playback mode being set
- Returns:
True if set, otherwise False
- Return type:
(bool)
- set_playing_state(playing, forward=True) bool[source]
Sets the playing state for the media
- Parameters:
playing (bool) – play if True, else stop
forward (bool) – plays forward if True, else reversed
- Returns:
True if set False otherwise
- Return type:
(bool)
- set_volume(volume: int) bool[source]
Sets current volume
- Parameters:
volume (int) – desired volume
- Returns:
True if success False otherwise
- Return type:
(bool)