1

I am currently trying to detect whether my AppleTV is currently running or not. As it seems to be always pingable I have taken a look at the AirPlay mechanisms behind the playback.

It seems that the HTTP GET request /playback-status should give me at least the information about a currently played movie/slideshow/music. When connecting to my AppleTV on Port 3689 and sending the corresponding request I always get a "400 Bad Request".

My Request:

GET /playback-info HTTP/1.1
Content-Length: 0
User-Agent: MediaControl/1.0

Server Response:

HTTP/1.1 400 Bad Request
Date: Sat, 27 Oct 2012 00:56:32 GMT
DAAP-Server: iTunes/11.0d46 (OS X)
Content-Type: application/x-dmap-tagged
Content-Length: 0

Does anybody have an idea what is wrong with my request, or has another idea to check whether the ATV is off/online?

Paul
  • 3,077
  • 2
  • 18
  • 20

1 Answers1

0

I'm pretty sure that the /playback-info request is only supposed to give info about an Airplay session's playback.

For an alternative, can you explain what you are trying to do? What do you mean by "whether the ATV is off/online"?

Also: the /playback-info request is usually accompanied by a X-Apple-Session-ID header which contains a random session id.

yydl
  • 24,284
  • 16
  • 65
  • 104
  • What I am trying to accomplish is to keep my Windows Home Server online while I am watching movies delivered from iTunes running on this server. The keep alive is normally accomplished by pinging the devices on the net. This works perfectly for every device that won't respond to ping requests while it is shut down. In contrast to other devices an AppleTV will respond to such requests as you can turn it on over the network connection. If I could determine whether the ATV is playing something I could keep the server alive. – Paul Oct 28 '12 at 01:28
  • @paul So are you saying that /playback-info gives you the same response even if iTunes is playing something at the time? – yydl Oct 28 '12 at 01:51
  • Yes, even with the ATV playing some music the result is the same. – Paul Oct 28 '12 at 02:07
  • I have also tried to use the same request with a random generated session id with the same result. I would also guess that one would first have to register this session ID with the ATV, but how? – Paul Oct 28 '12 at 02:08
  • @Paul Well music actually uses a different protocol. Try playing a video and see what it returns – yydl Oct 28 '12 at 02:36
  • @Paul as for the session id - it's generated by iTunes itself when it starts an Airplay video session. – yydl Oct 28 '12 at 02:36
  • Thanks for the hint with the different protocol for the music. During a video session I was able to get the corresponding session ID but even with this the request results in a Bad Request response. – Paul Oct 28 '12 at 03:04