How to get current play position and battery status AVRCP event #491
Answered
by
clarkbremer
hientv1999
asked this question in
Q&A
Replies: 2 comments
-
Many of these things are going to depend on both the os and the specific
app playing the music, and are thus out of your control. I've implemented
ff and rew in my A2DP Sink project, and they work reasonably well with
Amazon Music app on android, skipping about 3 secs in either direction.
But you are really at the mercy of the implementation of the app.
sennt frommy mobile phone with a tinny keybard
…On Sun, Oct 15, 2023, 11:29 PM Hien Van To ***@***.***> wrote:
Hi, I want to get the current play position and battery status notify from
my iPhone. I have modified the library files to support the new event
callback for battery status, and also implement the switch case for both
play position and battery status. As far as I tested, play position only
works on my old Android phone and doesn't work on my iPhone and Window 10
PC. Meanwhile, battery status doesn't work on iPhone (and probably Windows
10 either as I haven't got any event notify from this callback). I want to
know how to achieve this?
This is a bit extra, but I think the fast-forward and rewind doesn't work
on my iPhone either. I'm so jealous how my car can control all of these
thing easily. I wish I can achieve all these controls on ESP32.
Thank you very much for any suggestion or help.
—
Reply to this email directly, view it on GitHub
<#491>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXS2YD3UTSGVIQHYXFEYB3X7SZ23ANCNFSM6AAAAAA6BRTX6Y>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
pschatzmann
-
I have never looked into this, so I can't be of any help. The only recommendation I have is to create a subclass in your sketch and overwrite the method that you want to extend instead of making the changes in the BluetoothA2DPSink class. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I want to get the current play position and battery status notify from my iPhone. I have modified the library files to support the new event callback for battery status, and also implemented the switch case for both play position and battery status. As far as I tested, play position only works on my old Android phone and not on my iPhone and Windows 10 PC. Meanwhile, battery status doesn't work on iPhone, and probably Windows 10 either as I haven't got any event notify from this callback). I want to know how to achieve this
This is a bit extra, but the fast-forward and rewind method don't work on my iPhone either. I'm so jealous of how my car can control all of these things easily. I wish I could achieve all these controls on ESP32.
Thank you very much for any suggestions or help.
Below are steps I have tried:
I have changed metadata_flag as
int avrc_metadata_flags = ESP_AVRC_MD_ATTR_TITLE | ESP_AVRC_MD_ATTR_ARTIST | ESP_AVRC_MD_ATTR_ALBUM | ESP_AVRC_MD_ATTR_PLAYING_TIME;
But I believe this is the total length of the song, not the current play position
I have added these into the BluetoothA2DPSink::av_hdl_stack_evt method
/* initialize AVRCP target */
if (esp_avrc_tg_init() == ESP_OK){
esp_avrc_tg_register_callback(ccall_app_rc_tg_callback);
esp_avrc_rn_evt_cap_mask_t evt_set = {0};
esp_avrc_rn_evt_bit_mask_operation(ESP_AVRC_BIT_MASK_OP_SET, &evt_set, ESP_AVRC_RN_VOLUME_CHANGE);
esp_avrc_rn_evt_bit_mask_operation(ESP_AVRC_BIT_MASK_OP_SET, &evt_set, ESP_AVRC_RN_BATTERY_STATUS_CHANGE);
esp_avrc_rn_evt_bit_mask_operation(ESP_AVRC_BIT_MASK_OP_SET, &evt_set, ESP_AVRC_RN_PLAY_POS_CHANGED);
if(esp_avrc_tg_set_rn_evt_cap(&evt_set) != ESP_OK){
ESP_LOGE(BT_AV_TAG,"esp_avrc_tg_set_rn_evt_cap failed");
}
} else {
ESP_LOGE(BT_AV_TAG,"esp_avrc_tg_init failed");
}
I changed the ESP32 Class of Device to car stereo but it doesn't register the PLAY POS event from iPhone either. So CoD is not the reason my car can track play position but ESP32 cannot.
Updated: I have checked the remote rn_cap bitmask. On iPhone, I got 0x1f06, which translates to not support play position event. Meanwhile, on my Sony phone, I got 0x26, which translates to support the play position event. And in fact, the Sony phone works. So now the difference between a car Bluetooth and ESP32 Bluetooth is somehow the iPhone recognizes the car stereo differently and allow the play position event capability. Not sure if this is something not hard to solve.
Beta Was this translation helpful? Give feedback.
All reactions