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?