Skip to content

Controlling your Phone with AVRC Commands

pschatzmann edited this page Oct 3, 2026 · 9 revisions

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.

Playback Commands

a2dp_sink.play();
a2dp_sink.pause();
a2dp_sink.stop();
a2dp_sink.next();
a2dp_sink.previous();
a2dp_sink.fast_forward();
a2dp_sink.rewind();

Volume

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.

Testing if your Phone supports volume change notification

  • 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.

Older Arduino ESP32 Cores

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.

Clone this wiki locally