Add some helper functions to AVPlayer (#1864)

This commit is contained in:
Abdo 2022-05-13 06:08:05 +03:00 committed by GitHub
parent b6fb64fde1
commit f22d8015a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,6 +149,14 @@ class AVPlayer:
self._enqueued = tags[:]
self._play_next_if_idle()
def append_tags(self, tags: list[AVTag]) -> None:
"""Append provided tags to the queue, then start playing them if the current player is idle."""
self._enqueued.extend(tags)
self._play_next_if_idle()
def queue_is_empty(self) -> bool:
return bool(self._enqueued)
def stop_and_clear_queue(self) -> None:
self._enqueued = []
self._stop_if_playing()