SpriteOvO / AirPodsDesktop

☄️ AirPods desktop user experience enhancement program, for Windows and Linux (WIP)
GNU General Public License v3.0
1.49k stars 87 forks source link

[Bug Report] Airpods detection is not stable which sometimes pauses the music playback when "ear detection" is enabled #3

Closed luoluomeng closed 3 years ago

luoluomeng commented 3 years ago

:bug: Describe the bug

Airpods detection is not stable which sometimes pauses the music playback when "ear detection" is enabled

:scroll: To Reproduce

Steps to reproduce the behavior:

  1. Pair AirPods pro
  2. Start AirPodsDesktop
  3. Start NeteaseCloudMusic and play some music
  4. Listen to the music
  5. Music pauses sometimes
  6. Check the AirPodsDesktop immediately, the following status will show randomly:
    • AirPods2 with incorrect battery status
    • AirPods Pro but the battery status is incorrect(Such as Left:100%, right:30% but actually it's 30% 30%)
    • Disconnected

:rocket: Expected behavior

Music should continue playing and AirPodsDesktop should show the right status of AirPods pro

:framed_picture: Screenshots

image image image

:gear: Environments:

:star2: Additional context

SpriteOvO commented 3 years ago

@luoluomeng Thanks for reporting!

Music pauses sometimes

Yes, this is a known bug and I will try to fix it later.

AirPods2 with incorrect battery status

The battery values of AirPods 2 looks good, what's wrong with that?

AirPods Pro but the battery status is incorrect(Such as Left:100%, right:30% but actually it's 30% 30%)

Could you run AirPodsDesktop with the --trace argument, send the log file after a few seconds of running and write in the reply the value of the AirPods battery you see on your Apple device?

Disconnected

Does the disconnection happen randomly? If it happens after putting the AirPods back in the case, this is expected behavior because the AirPods will stop working with the Bluetooth module after that.

SpriteOvO commented 3 years ago

My screen fits 100% DPI, so I'm not sure if the title text (e.g. "AirPods 2", "Disconnected") size is appropriate for high DPI users? If so, I will make the window size vary with DPI, otherwise I will make the font size as fixed as the window.

luoluomeng commented 3 years ago

@SpriteOvO Thanks, I'll try the trace mode and get some logs, For the issues mentioned above(recognized as airpods2, disconnected, or incorrect battery percentage), I think there should be some incorrect data in the broadcast, maybe we need to filter the correct one.

My screen is 3840x2160 with 250% DPI, the title looks good but as the screenshot shows, there are some truncations on the battery percentage number.

luoluomeng commented 3 years ago

AirPodsDesktop.log Please check the log. I also tried another similar project Winpods which has a similar issue, attach its log as well and hope it helps: image

SpriteOvO commented 3 years ago

Hey, sorry it's a little late, I've pushed a few commits that should fix the problem, could you please test it (artifact)? Thank you!

luoluomeng commented 3 years ago

Hey, sorry it's a little late, I've pushed a few commits that should fix the problem, could you please test it (artifact)? Thank you!

Of course! It looks good now, and I'll keep using it to see if it's fixed completely.

SpriteOvO commented 3 years ago

@luoluomeng Any updates? I think this issue can be closed?

luoluomeng commented 3 years ago

Still observing, it's working well for 90% of the time, but it still has a chance to show the battery status when the AirPods is disconnected for a while: image

SpriteOvO commented 3 years ago

@luoluomeng It may be helpful to post trace logs from around the time of the problem (about 3 minutes). :)

SpriteOvO commented 3 years ago

So, if your AirPods are actually closed (2 pods are in the case and the lid is closed), the InfoWindow pop-up may be because someone near you is also using AirPods.

This may not be completely fixable, as we have no way to track AirPods reliably for Apple's privacy reasons (MAC addresses are Random Non-resolvable).

A workaround for this is to reduce the receiving range, which can ignore advertisement data packets broadcasted far away from your Bluetooth receiver. You can adjust this value in Settings in the tray right-click menu.

luoluomeng commented 3 years ago

Hmmm, adjust the range works, thanks!