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(logger)[source]

Bases: QObject

SIG_FRAME_CHANGED
SIG_MODIFIED
SIG_PLAY_STATUS_CHANGED
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]][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 will be returned.

Kwargs:

frames(List[int]): List of timeline sequence frames

Returns:

Clip-ids and Frames relative to the clips in the timeline.

Return type:

List[str, int]

Example of how the returned list will look like,

[
    ("clip_id_1", 1001), ("clip_id_1", 1002),
    ("clip_id_2", 1005), ("clip_id_2", 1006), ("clip_id_2", 1007),
    ("clip_id_3", 1001), ("clip_id_3", 1002)
]
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 current frame of the timeline. If no current clip is present then 0 is returned.

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[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]): Frames relative to the given clip.

Returns:

Frames relative to the timeline sequence.

Return type:

List[int]

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)

staticMetaObject = <PySide2.QtCore.QMetaObject object>