0

I'm developing a media player that streams mp3 files. I'm using the python gstreamer module to play the streams.

my player is the playbin2 element

When I want to query the position (with query_position(gst.FORMAT_TIME,None)), it always returns a gst.QueryError: Query failed. The song is definetly playing. (state is not NULL)

Does anyone have any experience with this?

PS: I also tried replacing gst.FORMAT_TIME with gst.Format(gst.FORMAT_TIME), but gives me the same error.

Stijn
  • 23
  • 3

3 Answers3

1

What does "you'll need to thread your own gst object" mean? And what does "wait until the query succeeds" mean?

State changes from NULL to PAUSED or PLAYING state are asynchronous. You will usually only be able to do a successful duration query once the pipeline is prerolled (so state >= PAUSED). When you get an ASYNC_DONE message on the pipeline's (playbin2's) GstBus, then you can query.

Tim
  • 276
  • 1
  • 3
0

From what source are you streaming? If you query the position from the playbin2 I'd say you do everything right. Can you file a bug for gstreamer, include a minimal python snippet that exposes the problem and tell from which source you stream - ideally its public.

ensonic
  • 3,304
  • 20
  • 31
0

I found it on my own. Problem was with threading. Apparently, you'll need to thread your gst object and just wait until the query succeeds.

Stijn
  • 23
  • 3