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

stops all playing audio on ios #118

Closed
extrawurst opened this issue Mar 19, 2024 · 5 comments
Closed

stops all playing audio on ios #118

extrawurst opened this issue Mar 19, 2024 · 5 comments

Comments

@extrawurst
Copy link

For games this is often not the desired behaviour, as people might wanna mute the games internal audio and listen to spotify, podcast or whatever still while playing.

I wonder if we can expose this as an option somehow, no idea how deep this goes: bevy_kira, kira itself or cpal

@extrawurst
Copy link
Author

a quick fix for anyone stumbling across this:

#import "bindings.h"
#import "AVFAudio/AVAudioSession.h"

int main() {
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil];
    main_rs();
    return 0;
}

@NiklasEi
Copy link
Owner

Nice, good to know. Would you like to open a PR for that?

@eugenehp
Copy link

eugenehp commented Jun 9, 2024

FYI: made bindings for avfaudio

use avfaudio::session::{AVAudioSession, Category};

pub fn main() {
    let shared_instance = AVAudioSession::shared_instance();
    shared_instance.set_category(Category::ambient());
}

@extrawurst
Copy link
Author

@eugenehp nice! I was hoping for icrates to eventually come around supporting AVAudioSession

@NiklasEi
Copy link
Owner

Did I understand correctly that this would be something the application (e.g., bevy_game_template) would configure if other audio is supposed to overlap instead of stop? In that case, I will close this issue but would love a PR to bevy_game_template as I don't have access to an iOS device myself.
Feel free to open the issue again if I misunderstood.

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

3 participants