Reputation: 672
I'm currently use react-native-track-player
version 1.1.8
to stream audio from Internet.
It works fine (react-native
version 0.61.4
)
I would like now to use it in background mode, to be able to continue to listen to radio if my app is in background mode.
I followed instructions from https://react-native-kit.github.io/react-native-track-player/background/, so add capabilities in xCode, which should be enough.
It doesn't work so I also add
TrackPlayer.updateOptions({
stopWithApp: false
});
but stil not working on real device on iOS 13. I can see this message when the app goes background :
Can't end BackgroundTask: no background task exists with identifier 1 (0x1),
or it may have already been ended.
Break in UIApplicationEndBackgroundTaskError() to debug.
But breakpoint does not give additional informations.
Any idea or experience with this audio library in background mode? Thanks!
Upvotes: 4
Views: 4875
Reputation: 481
For me, ticking, in Xcode, Audio, Airplay, and Picture in Picture
was the thing that did the trick. I didn't need to tick Background Processing
Upvotes: 1
Reputation: 21
1.Ticking Background processing as well in Background modes:
2.Adding Permitted background task scheduler identifiers to my app target at Xcode (info tab) with my app identifier as value.
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
Upvotes: 2
Reputation: 352
It seems that the background permissions structure in iOS 13 changed.
I had the same issue and solved it by:
Upvotes: 4