ESP32 Platformio Arduino BluetoothA2DPSink Metadata
Posted: Tue Dec 17, 2024 9:05 pm
hi,
I use the BluetoothA2DPSink library to stream music via Bluetooth. that works so far.
I have track information such as title and artist displayed on a TFT display.
That works too.
Now I would like to display the album cover on the TFT. I've researched whether this information exists about the metadata callback, but I can't get any further with the implementation
Does anyone have a code example to read the data for the image file (for example jpeg) into an array via a decoder and display it on the TFT?
here is my previous code:
and here i setup the callback
I am grateful for any help
many thanks in advance
I use the BluetoothA2DPSink library to stream music via Bluetooth. that works so far.
I have track information such as title and artist displayed on a TFT display.
That works too.
Now I would like to display the album cover on the TFT. I've researched whether this information exists about the metadata callback, but I can't get any further with the implementation
Does anyone have a code example to read the data for the image file (for example jpeg) into an array via a decoder and display it on the TFT?
here is my previous code:
Code: Select all
void avrc_metadata_callback(uint8_t id, const uint8_t *text){
Serial.printf("==> AVRC metadata rsp: attribute id 0x%x, %s\n", id, text);
if (id == ESP_AVRC_MD_ATTR_PLAYING_TIME){
uint32_t playtime = String((char *)text).toInt();
Serial.printf("==> Playing time is %d ms (%d seconds)\n", playtime, (int)round(playtime / 1000.0));
PlTi = (int)round(playtime / 1000.0);
}
if (id == 0x1){
tTitel = String((char *)text);
}
if (id == 0x2){
tArtist = String((char *)text);
}
TRA = TNAME + " - " + TART;
pTrack(tTitel, tArtist, cPS);
}
Code: Select all
a2dp_sink.set_avrc_metadata_attribute_mask(ESP_AVRC_MD_ATTR_TITLE | ESP_AVRC_MD_ATTR_ARTIST | ESP_AVRC_MD_ATTR_ALBUM | ESP_AVRC_MD_ATTR_PLAYING_TIME);
a2dp_sink.set_avrc_metadata_callback(avrc_metadata_callback);
I am grateful for any help
many thanks in advance