PlayManager#

class omni.kit.playlist.core.PlayManager(
playlist: PlaylistModel | None = None,
)#

Bases: object

Plays a playlist.

Parameters:

playlist (PlaylistModel) – Playlist to play; default is None

Methods

__init__([playlist])

Initializes the PlayManager instance.

destroy()

Destroys the current player and clears all associated resources and subscriptions.

navigate([index, item])

Navigates to a specific item in the playlist.

next()

Navigates tothe next item in the playlist.

play([model, navigation_mode])

Starts playback of the assigned playlist.

previous()

Navigates to the previous item in the playlist.

stop()

Stops the playlist playback if active.

subscribe_current_playlist_item_changed(...)

Subscribes a callback for when the current playlist item changes.

subscribe_playing_playlist_changed(...)

Subscribes a callback for when the playing playlist changes.

Attributes

current_item

Gets the current selected item from the playlist.

current_playlist

Gets the current playlist.

is_playing

Gets the status if the playlist is playing.

__init__(
playlist: PlaylistModel | None = None,
)#

Initializes the PlayManager instance.

destroy()#

Destroys the current player and clears all associated resources and subscriptions.

navigate(
index: int | None = None,
item: CardItem | None = None,
) bool#

Navigates to a specific item in the playlist.

Parameters:
  • index (Optional[int]) – Index of the navigation item.

  • item (Optional[CardItem]) – Specific item to navigate to.

Returns:

True if navigation is initiated successfully, otherwise False.

Return type:

bool

next() None#

Navigates tothe next item in the playlist.

play(
model: PlaylistModel | None = None,
navigation_mode: bool = False,
) bool#

Starts playback of the assigned playlist.

Parameters:
  • model (Optional[PlaylistModel]) – Playlist model to play; default is current playlist.

  • navigation_mode (bool) – Indicates if navigation mode is active.

Returns:

True if playback starts successfully, False otherwise.

Return type:

bool

previous() None#

Navigates to the previous item in the playlist.

stop()#

Stops the playlist playback if active.

subscribe_current_playlist_item_changed(
on_current_playlist_item_changed_fn: Callable,
)#

Subscribes a callback for when the current playlist item changes.

Parameters:

on_current_playlist_item_changed_fn (Callable) – Callback invoked when the current playlist item is updated.

Returns:

Subscriber instance for the current playlist item change.

Return type:

PlaylistCardSubscriber

subscribe_playing_playlist_changed(
on_playing_changed_fn: Callable[[str], None],
)#

Subscribes a callback for when the playing playlist changes.

Parameters:

on_playing_changed_fn (Callable[[str], None]) – Callback triggered on playing playlist change.

Returns:

Subscription handle for the playing playlist change.

Return type:

Object

property current_item: CardItem | None#

Gets the current selected item from the playlist.

Returns:

The currently selected playlist card.

Return type:

Optional[CardItem]

property current_playlist: PlaylistModel | None#

Gets the current playlist.

Returns:

The currently assigned playlist.

Return type:

Optional[PlaylistModel]

property is_playing: bool#

Gets the status if the playlist is playing.

Returns:

True if a playlist is playing, otherwise False.

Return type:

bool