After some time experimenting I've discovered a way to do this. Python's winrt binding library exposes the GlobalSystemMediaTransportControlsSessionManager
, after getting the current session you can call get_timeline_properties()
, which in turn will give you a GlobalSystemMediaTransportControlsSessionTimelineProperties object, that exposes a couple of useful attributes, including the current position of a playing track. Some credit goes to this question.
So, assuming current_session from the linked question, a simple one-liner to get the position is:
current_session.get_timeline_properties().position.seconds
Note: It seems it likes to lag for about 2 seconds behind the actual track, and there's no finer resolution, only full seconds are supported it seems.