Repository navigation
Controlling your Phone with AVRC Commands
When the A2DP Sink is connected, you can use AVRC (Audio/Video Remote Control) to 'control' the A2DP Source (e.g. the music app on your phone), as long as the source application supports it.
a2dp_sink.play();
a2dp_sink.pause();
a2dp_sink.stop();
a2dp_sink.next();
a2dp_sink.previous();
a2dp_sink.fast_forward();
a2dp_sink.rewind();set_volume() and get_volume() are based on AVRC: you can change the volume both from the ESP32 and from the phone, and the changes are updated on both devices. You can be notified about volume changes with set_on_volumechange(). See also Volume Control.
Please note that this only works if the phone supports volume change notifications. Mostly older Android devices do not support this! If the phone does not support them, the volume managed by the phone and the volume managed by the ESP32 are independent of each other: a volume change on the phone still changes the volume of the signal that is played, it is just not visible via the API.
- Set the log level to Verbose
- Deploy your sketch
- Change the volume on your phone: if you see that events are triggered in the log, your phone supports volume change notifications.
With the Arduino ESP32 core 1.0.6 the volume was not synchronized via AVRC: set_volume() and get_volume() only changed the local volume. This requires Arduino ESP32 core 2.0.0 (ESP-IDF 4.4) or later.
To receive information from the phone (title, artist, playback status), see Metadata & Notifications.
Getting Started
A2DP Sink (Receiver)
- Overview & Examples
- Audio Output & DACs
- Sample Rate
- Volume Control
- AVRC: Controlling your Phone
- Metadata & Notifications
- Performance Optimizations
A2DP Source (Sender)
Common
Background
Help