Coder Social home page Coder Social logo

Comments (8)

ukasz123 avatar ukasz123 commented on September 3, 2024 1

That's default behavior of iOS apps.
I was trying to mimic the Android SoundPool API on iOS but iOS application have a single AVAudioSession active and there is no such thing as stream types from Android.
If you want your app to allow background music to not be silenced by your app you need to change the AVAudioSession's category according to this guide.

from soundpool.

ahaboubi avatar ahaboubi commented on September 3, 2024

Changing the AVAudioSession's category works as expected.

Thank you!

from soundpool.

denniske avatar denniske commented on September 3, 2024

@ahaboubi I have the same problem. Can provide the code changes that you have done to make it work?

from soundpool.

JmyW avatar JmyW commented on September 3, 2024

@ahaboubi @deniza
I'm not sure I understand the solution "AVAudioSession" you mentioned above. If the music app was my designed app, I agree that I can set AVAudioSession something like mixWithOthers in the music app but it's not mine. Or are you meaning to set AVAudioSession mode in SoundPool? how? Could you share more how you fix it? thanks in advance!

from soundpool.

denniske avatar denniske commented on September 3, 2024

@JmyW I also was not able to fix it with AVAudioSession. So I have switched to the library audioplayers which does not have this problem.

from soundpool.

ukasz123 avatar ukasz123 commented on September 3, 2024

audioplayers library does exactly that: it updates the AVAudioSession config when it is going to play notification sound or something similar. It has way more features (it can also can use Soundpool on Android) but this plugin is focused on simplicity and short sound effects management.

from soundpool.

deniza avatar deniza commented on September 3, 2024

@JmyW Thats the native code you should add somewhere applicable in your ios project. (Runner.xcodeproj)

Personally I put it into some custom plugin function, but I think that you can safely call it from didFinishLaunchingWithOptions in AppDelegate.swift. Also remember to import AVFoundation

from soundpool.

JmyW avatar JmyW commented on September 3, 2024

@deniza @denniske Got it. thanks for let me know. However just for your reference, I've known some others like audioplayers that support mode "respectSilence" set true during initiation to enable the co-existence with background music. That maybe an idea make this package stronger.

To be honest, I tend to use soundpool rather than audioplayers since I am not designed a "players" but an application. And I'm actually seeing audioplayers' issue when special situation in my code, that's why I'm searching better & tiny solution like soundpool.

from soundpool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.