def airplay_callback(pkt): try: print pkt if pkt.rtsp.Method == "RECORD": print "PLAYBACK STARTED" playback.airplay_toggle() if pkt.rtsp.Method == "TEARDOWN": print "PLAYBACK STOPPED" playback.airplay_toggle() except: pass
def airplay_toggle(): playback.airplay_toggle() return "toggling airplay"