Code Monkey home page Code Monkey logo

Comments (7)

edferreira avatar edferreira commented on July 30, 2024 3

I've faced this issue too. I could solve It by using SoundPlayer.setSpeaker(false).

To be able for an audio to be played in background the following category is needed to be setup. Which is done when you setSpeaker to false
[session setCategory: AVAudioSessionCategoryPlayback error: nil]
Also you need to enable the Background Mode on your capabilities to enable audio, airplay and picture in picture

from react-native-sound-player.

ithustle avatar ithustle commented on July 30, 2024 1

@strawberry-code, I strongly recomend to use this one https://github.com/react-native-kit/react-native-track-player

from react-native-sound-player.

johnsonsu avatar johnsonsu commented on July 30, 2024

Hi @danias, thank you for using the package! I will consider adding background playing ability in the future, but for now, this library will stay simple. For the mean while, you may consider using a slightly more robust package https://github.com/react-native-kit/react-native-track-player.

from react-native-sound-player.

ithustle avatar ithustle commented on July 30, 2024

Hi @danias, try use with this lib https://github.com/tanguyantoine/react-native-music-control and set your app the ability to run on background on Xcode

from react-native-sound-player.

strawberry-code avatar strawberry-code commented on July 30, 2024

Any news here? Is now this library capable of playing sounds in background?

from react-native-sound-player.

jenipharachel avatar jenipharachel commented on July 30, 2024

@edferreira Can you share more on what all you did to make this library play in the background state of a react-native app?

from react-native-sound-player.

jameszhong2008 avatar jameszhong2008 commented on July 30, 2024

@jenipharachel
Just call SoundPlayer.setSpeaker(false) before play sound in iOS.

from react-native-sound-player.

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.