Start
|
Scan, Pair and Connect
|
Device Information
|
Control
|
Power Management
|
Features
|
Metadata
|
Listeners
|
Stream
|
Storage
|
Apps
|
Audio
|
Keyboard
|
Logging
|
Examples
Audio
Protocols supporting volume controls can be controlled via the audio interface.
Using the Audio API
After connecting to a device, you get the apps interface via interface.AppleTV.audio:
atv = await pyatv.connect(config, ...)
audio = atv.audio
To get current volume level, use interface.Audio.volume:
print("Volume:", audio.volume)
To change current volume, use interface.Audio.set_volume:
await audio.set_volume(20.0)
The volume level is normalized in the interval 0.0-100.0, where 0.0 means the audio is muted.
You can also step volume up or down using step level provided from the device (if available):
await audio.volume_up()
await audio.volume_down()
The audio API supports push updates via a listener, as described here.