react-native-track-player: [IOS] Background Music stops when opening the app
Configuration
package.json
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-track-player": "^1.1.3",
"react-native-swift": "^1.2.2",
react-native info
Environment:
OS: macOS High Sierra 10.13.6
Node: 8.11.2
Yarn: 1.9.4
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 10.1 Build version 10B61
Android Studio: 3.2 AI-181.5540.7.32.5056338
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4
Problem
If you are listening to music from anything else on your phone and you start the application. Even if the player is not created yet by calling TrackPlayer.setupPlayer() the music gets stopped as soon as the app starts.
This problem only happened to me on iOS. And after the app is launched we can go back to music play and go back to the app the music won’t stop (except when calling the play on the player but that’s normal behaviour) 😉
Did I miss a step of the configuration or is that a bug ?
I think it is related but when I was launching the app from XCode I saw this logs coming in loop :
xxx[553:35364] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port 擴音 (type: Speaker)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (17 by maintainers)
Looks like #500 addresses this
@thessler27 It was indeed that piece of code that was causing the stop when launching the app I will be back to the normal branch it should be working with the
1.1.3version So I just tried the1.1.3version and it’s working well with it For theSessionCategories.swiftmaybe there is a link missing on the project on the dev branch ?Thanks for your help 👍 Hope to see a
1.1.4soon ❤️