[python] check if state is playing

Pablo Rodríguez oinos at web.de
Mon Nov 29 06:45:42 UTC 2021

On 11/28/21 9:51 PM, Michael Gruner via gstreamer-devel wrote:
> 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

Many thanks for your help, Michael.

This solves my issue. I expected a string and I didn’t know how to deal
with the returns.

> You can pass in a timeout to the state query as
> in pipeline.get_state(timeout=gst.SECOND).

It’s also good to know this.

Many thanks for your help again,


More information about the gstreamer-devel mailing list