Skip to content

Initialize the route change enum correctly #2

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

blwinters
Copy link

@blwinters blwinters commented May 26, 2025

This addresses these issues:

The onVideoAudioBecomingNoisy handler wasn't being called becuase this line resulted in reason: nil.

let reason: AVAudioSession.RouteChangeReason! = userInfo[AVAudioSessionRouteChangeReasonKey] as? AVAudioSession.RouteChangeReason

The correct way to get the AVAudioSession.RouteChangeReason is to initialize it with the raw value provided by userInfo, as confirmed by Apple documentation.

I've confirmed with print statements that the reason is no longer nil and the handler is called when headphones are unplugged during playback.

I also updated the commented-out line for consistency. I'll submit a PR to the original repo once this is tested and approved for our fork.

Testing

Connect a physical iPhone to Xcode via wifi and plug in USB-C headphones to the iPhone. In package.json for Floatplane, change the source branch for this package to match this PR's branch, then do a clean install of dependencies. Once installed, build and run the app on your iPhone via Xcode.

@blwinters blwinters requested a review from Jadeon-FPM May 26, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant