开始于 Cider 突然无法连接到我的接收器(Marantz NR1510,支持 Airplay),而 iPhone 设备仍然可以。
我加载了
pyatv
,戳它,发现一般网络 scan
没有检测到任何东西,但使用 hosts
kwarg 连接就可以了。解析响应时,Airplay 表示不需要凭据、密码或配对。当我尝试使用 remote
或 audio
采取任何行动时,接收器上没有任何反应,我也没有例外。尝试使用 stream_file
会导致 not authenticated
错误消息。
关于如何解决这个问题有什么想法吗?我真的很想能够使用
stream_file
方法,只是因为我知道它现在就在那里,但我怀疑这里发生的任何问题都会导致潜在的苹果酒问题,而且我绝对想解决这个问题。但这对我来说也是一些新领域,之前没有使用过 Apple TV/ROAP。
我已确认 ApplyPlay 已配置为允许网络上的任何人访问它。网络上没有帐户相关设备能够连接。为接收器格式化的原始 telent 命令也可以成功运行。就像非苹果设备似乎无法“看到”接收器一样。
import asyncio, pyatv
from time import sleep
log = print
async def main():
loop = asyncio.get_event_loop()
# This returns an empty list
no_devices = await pyatv.scan(loop)
# this returns my receiver
devices = await pyatv.scan(loop, hosts=[""])
receiver = await pyatv.connect(devices[0], loop)
log(receiver.service, receiver.device_info)
await receiver.stream.stream_file("path/to/song.mp3")
audio_control = receiver.audio
log(audio_control.volume)
await audio_control.set_volume(40)
log(audio_control.volume) # This reports the new volume, but subsequent executions report the 'old' volume
# This runs without error, but there is 0 activity seen/no result on the receiver.
for i in range(44):
await receiver.remote_control.volume_up()
sleep(2.0)
for i in range(24):
await receiver.remote_control.volume_down()
receiver.close()
if __name__ == '__main__':
asyncio.run(main())