-
Notifications
You must be signed in to change notification settings - Fork 129
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
iOS 16: fix playback for podcasts with a single channel + Spatial Audio enabled #213
iOS 16: fix playback for podcasts with a single channel + Spatial Audio enabled #213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, 👏 👏 bravo, very nice fix. I tested using my own mono audio files and the test podcast and reproduced the issue then switched to the branch and all is working now.
I left a comment about using some force unwrapping and whether we need to do it.
podcasts/AudioReadTask.swift
Outdated
// In order to prevent this issue, we convert a mono buffer to stereo buffer | ||
// For more info, see: https://github.com/Automattic/pocket-casts-ios/issues/62 | ||
var audioBuffer: BufferedAudio | ||
if #available(iOS 16, *), audioPCMBuffer!.audioBufferList.pointee.mNumberBuffers == 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
audioPCMBuffer!.audioBufferList.pointee.mNumberBuffers
Do we need to force unwrap here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops, we don't. Removed in 1a5cb6b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
…-when-spatial-audio-is-enabled iOS 16: fix playback for podcasts with a single channel + Spatial Audio enabled
…-when-spatial-audio-is-enabled iOS 16: fix playback for podcasts with a single channel + Spatial Audio enabled
Fixes #62
iOS 16 seems not to like the combination of mono audio (single channel) and Spatial Audio enabled. When those two conditions are met and
EffectsPlayer
is used the audio just doesn't work.This seems to be an issue on Apple's side, but given they might not fix it by the time iOS 16 is released, it is good to handle it on our app.
The change works in this way: if the user is on iOS 16 and the user is playing a file with one single channel, we convert the buffer to 2 channels to avoid this issue.
To test
There are a few ways to test this PR, by manually adding your own files and by testing with podcasts. But before testing, make sure that:
All done? Let's go.
Testing with a podcast
Testing with audio files
You can use your own audio files with one or two audio channels, or you can download some here: https://espressif-docs.readthedocs-hosted.com/projects/esp-adf/en/latest/design-guide/audio-samples.html
Checklist
CHANGELOG.md
if necessary.