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

Listen for AirPods connection changes #1186

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

chickdan
Copy link
Contributor

This is by no means the cleanest solution so input is most welcome (primarily on where to put this). Most of this was taken right from Apple's docs and from what I've tested it works nicely.

With this being shared code I do have some concern as I cannot test against an AppleTV. Additionally, I am unsure what else may trigger the AVAudioSession.routeChangeNotification.

Closes #1160

LePips
LePips previously approved these changes Aug 16, 2024
Copy link
Member

@LePips LePips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought about making nice wrapper framework for all of the now playing/headphones stuff since they're older APIs and could have some SwiftUI bridges. I'm fine with this currently since I'll be refactoring the entire VideoPlayerManager layer.

I'll be able to test and approve later. (edit: misclicked initial approval)

@LePips LePips self-requested a review August 16, 2024 01:55
@chickdan chickdan marked this pull request as ready for review August 17, 2024 22:39
@chickdan
Copy link
Contributor Author

Sounds good! Thanks for taking a look!

@chickdan
Copy link
Contributor Author

@LePips I reworked this to use the MPRemoteCommandCenter instead which greatly simplifies the code, Apple docs. Hopefully this change will also close #1166.

Copy link
Member

@LePips LePips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works and I've been working in the MPRemoteCommandCenter anyways for all the now playing stuff 👍

@LePips LePips merged commit e5f408a into jellyfin:main Aug 19, 2024
4 checks passed
@chickdan chickdan deleted the toggle_playback_on_airpods_connection branch August 19, 2024 20:48
@LePips LePips added the enhancement New feature or request label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When AirPods are removed, media continues playing out loud
2 participants