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

Sound.Category Not Working On IOS 14 #56

Closed
Hartistic opened this issue Oct 6, 2020 · 3 comments
Closed

Sound.Category Not Working On IOS 14 #56

Hartistic opened this issue Oct 6, 2020 · 3 comments

Comments

@Hartistic
Copy link

On IOS 14 (maybe earlier versions as well) changing the AVAudioSession's category utilizing Sound.category doesn't seem to work as intended.

If you would like to disable playing simultaneous audio tracks and want to switch to only playing one at a time, you should be able to set the category to .playback or .soloAmbient to disable "mixing". When changing the category however, audio still mixes.

By the way, loving this library thus far as it has saved me a lot of time, thank you!

@lezone
Copy link

lezone commented Oct 27, 2020

Hi, I'm running into an issue that may be iOS 14 related as well. (I am very green so please bear with me if this is operator error).

What I'm finding is that creating an instance doesn't work (no sound).

This works:

                    let url = URL(fileURLWithPath: Bundle.main.path(forResource: "bell.mp3", ofType:nil)!)
                    Sound.play(url: url)

But this doesn't:

                    let url = URL(fileURLWithPath: Bundle.main.path(forResource: "bell.mp3", ofType:nil)!)
                    let alarmSound = Sound(url: url)!
                    alarmSound.play()

Since the first one works I'm assuming it isn't related to the URL or the sound file.

Any thoughts?

Dan

@aloveric
Copy link

aloveric commented Jan 5, 2021

Hi, I'm running into an issue that may be iOS 14 related as well. (I am very green so please bear with me if this is operator error).

What I'm finding is that creating an instance doesn't work (no sound).

This works:

                    let url = URL(fileURLWithPath: Bundle.main.path(forResource: "bell.mp3", ofType:nil)!)
                    Sound.play(url: url)

But this doesn't:

                    let url = URL(fileURLWithPath: Bundle.main.path(forResource: "bell.mp3", ofType:nil)!)
                    let alarmSound = Sound(url: url)!
                    alarmSound.play()

Since the first one works I'm assuming it isn't related to the URL or the sound file.

Any thoughts?

Dan

Same for me

@SuperWomble
Copy link

The Sound instance is probably going out of scope immediately, terminating the underlying AVAudioPlayer instance. You probably want to keep a strong reference to each instance.

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

No branches or pull requests

5 participants