Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MacOS Focus Lost After Manually Skipping Songs in Gapless Playback #715

Closed
fr-eed opened this issue Oct 22, 2024 · 13 comments · Fixed by #735
Closed

[BUG] MacOS Focus Lost After Manually Skipping Songs in Gapless Playback #715

fr-eed opened this issue Oct 22, 2024 · 13 comments · Fixed by #735
Labels
bug Something isn't working

Comments

@fr-eed
Copy link
Contributor

fr-eed commented Oct 22, 2024

When the "Gapless playback" feature is enabled, Dopamine loses media focus after manually skipping a few songs using the "Now Playing" feature in macOS Control Center or multimedia keys. Once Dopamine loses focus, pressing the multimedia keys (play/pause, next/previous) defaults to controlling Apple Music instead of Dopamine.

Steps to Reproduce:

Enable "Gapless playback" in Dopamine.
Restart the app.
Play any song.
Skip a song using multimedia keys or via the macOS Control Center.
Unfocus or close the Dopamine main window.
Skip a song again using multimedia keys or Control Center.
Observe that media focus is lost, and multimedia keys no longer control Dopamine.
Press multimedia keys again, and Apple Music takes over media control.

MacOS version: macOS 15.0.1
Dopamine: 3.0.0-preview.36

@digimezzo
Copy link
Owner

@fr-eed Thank you for the bug report. I'll investigate this.

@fr-eed
Copy link
Contributor Author

fr-eed commented Oct 22, 2024

Also to note. Currently Dopamine works weirdly with the Control Center Now Playing widget, after switching a song it disappears for a moment and then appears

@digimezzo
Copy link
Owner

@fr-eed Does this also happen when gapless playback is disabled?

@fr-eed
Copy link
Contributor Author

fr-eed commented Oct 22, 2024

@fr-eed Does this also happen when gapless playback is disabled?

Yes

Screen.Recording.2024-10-22.at.9.22.06.PM.mov

digimezzo added a commit that referenced this issue Oct 22, 2024
@digimezzo
Copy link
Owner

@fr-eed Keep an eye in this build: https://github.com/digimezzo/dopamine/actions/runs/11468241556

It's currently building. As soon as it has artifacts, could you try it out? I tried to fix the problem in it. Thanks!

@fr-eed
Copy link
Contributor Author

fr-eed commented Oct 22, 2024

@fr-eed Keep an eye in this build: https://github.com/digimezzo/dopamine/actions/runs/11468241556

It's currently building. As soon as it has artifacts, could you try it out? I tried to fix the problem in it. Thanks!

So, gapless playback doesn't cause initial bug but now:

  • After selecting any song/skipping, it starts playing for 200 ms and then restarts from the beginning causing it to repeat a sequence.
  • Sometimes previews fail to load in Playing Now widget.

Behavior shown in my video still persists

Maybe MacOS doesn't need the gapless feature at all?

@digimezzo
Copy link
Owner

@fr-eed Thanks for the info. This seems more complicated than I thought. I'll test it out here on a macOS Virtual Machine.

@fr-eed
Copy link
Contributor Author

fr-eed commented Oct 23, 2024

@digimezzo
Expected behavior for reference

Screen.Recording.2024-10-23.at.11.05.55.AM.mov

@digimezzo
Copy link
Owner

digimezzo commented Oct 27, 2024

@fr-eed Could you try out this build? https://github.com/digimezzo/dopamine/actions/runs/11548036703
Thank you.

@digimezzo digimezzo added bug Something isn't working and removed investigate labels Oct 27, 2024
@fr-eed
Copy link
Contributor Author

fr-eed commented Oct 28, 2024

@fr-eed Could you try out this build? https://github.com/digimezzo/dopamine/actions/runs/11548036703 Thank you.

Works good without gapless playback. Now Playing widget integration works as intended but sometimes author gets updated slower than the music title

With gapless playback original bug still exists but not as consistent. I need to use app for some time for it to appear. It's easier to trigger if you have second player running in the background

Also that still exists with gapless playback on:

After selecting any song/skipping, it starts playing for 200 ms and then restarts from the beginning causing it to repeat a sequence.

@digimezzo
Copy link
Owner

@fr-eed Thanks for testing out. Is it possible to make a video of the 200ms problem? I'm not sure how I should reproduce that. Thanks

@fr-eed
Copy link
Contributor Author

fr-eed commented Oct 28, 2024

@fr-eed Thanks for testing out. Is it possible to make a video of the 200ms problem? I'm not sure how I should reproduce that. Thanks

It's an audio issue. I can share a recording later.

After some more testing I've found out that this bug occurs only with wireless headphones. Most likely system wants to sync it with wireless delay and your app overrides it

@fr-eed
Copy link
Contributor Author

fr-eed commented Nov 11, 2024

Screen.Recording.Dopamine.mp4

It sounds like this with gapeless playback on with bluetooth headphones connected as main audio output.

Tested on this build: https://github.com/digimezzo/dopamine/actions/runs/11619031390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants