Shairport-sync: player state confusion

Created on 10 Jul 2018  Â·  6Comments  Â·  Source: mikebrady/shairport-sync

When press 'Play' button from iPhone Music, the device will receive the following RTSP requests: ANNOUNCE, SETUP, RECORD, FLUSH;

When press "Pause' button from iPhone Music, the device will receive the following RTSP requests:
FLUSH, TEARDOWN;

From the unofficial airplay specification http://nto.github.io/AirPlay.html , it says the FLUSH request stops the streaming, why the FLUSH request appears both operations 'Play' and 'Pause' ?

question

Most helpful comment

yes, I did not recognized that the iOS is different from iTunes. I will try to compared the difference between them. If you understand more, please keep me updated. thanks a lot

All 6 comments

Thanks for the comment. I'm afraid I don't know for sure, and I suspect nobody else can give a definitive public answer (I'd love to be wrong, BTW). The protocol has never been published by Apple.

AFAIK, it is not something being caused or generated by Shairport Sync.

Thanks for your answer. Now I am experiencing a problem. When I send dbus command 'Pause' to shairport-sync, it will be transformed to a DACP command 'pause' and be sent to Airplay client, then shairport-sync will receive RTSP requtets FLUSH, and TEARDOWN. the FLUSH is received very soon, but TEARDOWN normally arrives three or five seconds later. Do you have any suggestion to get the Paused state ASAP when I send dbus command 'Pause'?

My understanding of the sequence is different to yours: when the FLUSH command is received by Shairport Sync, I believe it indicates that the sender is paused. Then, a few seconds later, when the TEARDOWN is received, is signifies that the sender is stopped (and Shairport Sync tears everything down and enters its own stopped or idle state).

So in my view, it goes to the paused state immediately, and then a few seconds later it goes into the stopped state. The transition from paused to stopped is completely under the control of the source.

I thought it should work like this. "when the FLUSH command is received by Shairport Sync, I believe it indicates that the sender is paused. Then, a few seconds later, when the TEARDOWN is received, is signifies that the sender is stopped . "

But what I get is when I play from iPhone Music, Shairport Sync also get FLUSH following ANNOUNCE, SETUP, RECORD, so I have no way to distinguish the paused state from FLUSH command.

It seems to me that we have to approach it experimentally — observe the behavior and try to infer the underlying structure and design. And the behaviors of iTunes and iOS are different.

yes, I did not recognized that the iOS is different from iTunes. I will try to compared the difference between them. If you understand more, please keep me updated. thanks a lot

Was this page helpful?
0 / 5 - 0 ratings