[python] check if state is playing
Michael Gruner
michael.gruner at ridgerun.com
Sun Nov 28 20:51:49 UTC 2021
Hey Pablo
Python will return the current and pending states along with the return in a tuple as the following:
(ret, state, pending) = pipeline.get_state()
Then you can compare as usual:
if state == gst.STATE_PLAYING:
pass
You can pass in a timeout to the state query as in pipeline.get_state(timeout=gst.SECOND).
Michael
> On 28 Nov 2021, at 11:58, Pablo Rodríguez via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
>
> Dear list,
>
> is there a way to check whether a player is in playing state?
>
> I mean, something similar to Python pseudocode:
>
> if self.player.get_state(0)[1] == "GST_STATE_PLAYING":
>
> Sorry, but I couldn’t find any reference for that.
>
> Many thanks for your help,
>
> Pablo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20211128/0496c6f8/attachment.htm>
More information about the gstreamer-devel
mailing list