Reliable MediaObject::totalTime() queries
-
I need to reliably retrieve the totalTime() of MediaObjects. The problem is, initially an object is in Phonon::LoadingState. In this state, totalTime (and most other object information) is not defined/available.
This results in a sort of race condition where attempts to retrieve the totalTime of a MediaObjects results in undefined behavior.
How may I force a MediaObject to retrieve this information and wait for it to be available? I realize it's likely a performance optimization, but the totalTime value is more important to me than a hit to initial loading performance.
I tried to force it by calling MediaObject::stop(), putting the object into a different Phonon::State (Phonon::StoppedState) a transition the docs hinted may do the trick. But this didn't work.
My last resort would be doing some kind of loop that breaks when the MediaObject leaves the Phonon::LoadingState (with timeout).