Skip to content

Initialize the route change enum correctly#2

Merged
Jadeon-FPM merged 1 commit intodevelopfrom
fix/audio-noisy
Jul 31, 2025
Merged

Initialize the route change enum correctly#2
Jadeon-FPM merged 1 commit intodevelopfrom
fix/audio-noisy

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
@Jadeon-FPM Jadeon-FPM merged commit 821eb24 into develop Jul 31, 2025
5 checks passed
@Jadeon-FPM
Copy link
Collaborator

Seems to work! Is there a pull for upstream yet?

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.

2 participants