react-native-track-player: iOS: NSInternalInconsistencyException and RCTEventEmitter error (maybe RCTBridge)

I have this error when building a new app. The only changes that I did was upgrading react-native-track-player from 1.2.3 to 1.2.5 and upgrading react-navigation from 3 to 5. Don’t know if it may help.

react-native: 0.60.6 react-native-track-player: 1.2.5 OS: Mojave 10.14.6 Xcode: 11.3.1

Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Error when sending event:
playback-state with body: {
    state = ready;
}. 
Bridge is not set. This is probably because you've explicitly synthesized
the bridge in RNTrackPlayer, even though it's inherited from RCTEventEmitter.'

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I just updated to 2.1.2 and found that this happens a lot. Seems like there wasn’t a fix for this? @dcvz should the issue be reopened?

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: playback-track-changed with body: {
nextTrack = 7;
position = "59.89625850340136";
track = 6;
}. Bridge is not set. This is probably because you've explicitly synthesized the bridge in RNTrackPlayer, even though it's inherited from RCTEventEmitter.'```

This happens to me 100% of the time if I 1) start playing audio 2) restart the app through expo BUT NOT Xcode 3) try playing audio again. After step 2, the audio still continues to play even though my app is in its initial state. Sometimes, I’ll get double overlapping audio playing for a few seconds before the crash. I’m assuming it’s got something to do with tearing down the TrackPlayer. I set ‘stopWithApp: true’ in updateOptions, but maybe expo updates don’t count?