From 097abf81eb4cf10f26ad5c6aa485b06158eece2a Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Thu, 7 Apr 2011 15:19:18 +0200 Subject: Implement playback-info request to fix playback on iOS 4.3+ --- AirPlayService.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'AirPlayService.py') diff --git a/AirPlayService.py b/AirPlayService.py index 394c434..b6f6ae3 100644 --- a/AirPlayService.py +++ b/AirPlayService.py @@ -94,7 +94,57 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): answer = "" # process the request and run the appropriate callback - if (request.uri.find('/play')>-1): + if (request.uri.find('/playback-info')>-1): + self.playback_info() + content = '\ +\ +\ +\ +duration\ +%f\ +position\ +%f\ +rate\ +%f\ +playbackBufferEmpty\ +<%s/>\ +playbackBufferFull\ +\ +playbackLikelyToKeepUp\ +\ +readyToPlay\ +<%s/>\ +loadedTimeRanges\ +\ + \ + duration\ + %f\ + start\ + 0.000000\ + \ +\ +seekableTimeRanges\ +\ + \ + duration\ + %f\ + start\ + 0.000000\ + \ +\ +\ +' + d, p = self.service.get_scrub() + if (d+p == 0): + playbackBufferEmpty = 'true' + readyToPlay = 'false' + else: + playbackBufferEmpty = 'false' + readyToPlay = 'true' + + content = content % (float(d), float(p), int(self.service.is_playing()), playbackBufferEmpty, readyToPlay, float(d), float(d)) + answer = self.create_request(200, "Content-Type: text/x-apple-plist+xml", content) + elif (request.uri.find('/play')>-1): parsedbody = request.parse_headers(request.body.splitlines()) self.service.play(parsedbody['Content-Location'], float(parsedbody['Start-Position'])) answer = self.create_request() -- cgit v1.1-32-gdbae