react-native-track-player: Notification controls are not working.
Configuration
Run react-native info in your project and share the content.
What react-native-track-player version are you using?
Issue
Player is working fine but the notification button is not firing any action.
Code
TrackPlayer.setupPlayer(); TrackPlayer.updateOptions({ stopWithApp: true, capabilities: [ TrackPlayer.CAPABILITY_PLAY, TrackPlayer.CAPABILITY_PAUSE, TrackPlayer.CAPABILITY_STOP, TrackPlayer.CAPABILITY_SKIP_TO_NEXT, TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS ], compactCapabilities: [ TrackPlayer.CAPABILITY_PLAY, TrackPlayer.CAPABILITY_PAUSE, TrackPlayer.CAPABILITY_STOP ] }); // this.togglePlayback(); }
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 19 (1 by maintainers)
Commits related to this issue
- [iOS] Override SwiftAudio enableRemoteCommands behavior. Related: #746 #747 #775 #820 #831 #834 #881 — committed to doublesymmetry/react-native-track-player by curiousdustin 4 years ago
I rolled back to 1.1.8, and similar issues. The play/pause, skip forward, skip backward show up, however only the play/pause work.
Controls show up incorrectly. Play/pause works however.

So, I found how to fix this problem in my case: in
/android/build.gradle, changecompileSdkVersionandtargetSdkVersionto29. May be related to #859.EDIT: So it was actually not related to version but to the reloading of app… Not stopping (even pausing) music before reloading seems to break notifications buttons. May happen only during development (y).
@Guichaguri
I have exactly the same issue, for me the jump-forward and backward button appears at first track when getting out from the component and setup new player the buttons disappears and are replaced with “<<” “>>” or it is only one of them appearing.
tried upgrading between versions but no success.
Version: 1.1.8 “react”: “^16.9.0”, “react-native”: “0.61.5”,
SERVICE.JS:
import TrackPlayer from “react-native-track-player”;
module.exports = async () => {
};
TRACKPLAYER.IOS.JS function where I updateOptions:
upDateOptionsHandler = async () => { await TrackPlayer.updateOptions({ jumpInterval: 10, capabilities: [ TrackPlayer.CAPABILITY_PLAY, TrackPlayer.CAPABILITY_PAUSE, TrackPlayer.CAPABILITY_STOP, TrackPlayer.CAPABILITY_SEEK_TO, TrackPlayer.CAPABILITY_JUMP_FORWARD, TrackPlayer.CAPABILITY_JUMP_BACKWARD ], compactCapabilities: [ TrackPlayer.CAPABILITY_PLAY, TrackPlayer.CAPABILITY_PAUSE, TrackPlayer.CAPABILITY_STOP, TrackPlayer.CAPABILITY_JUMP_FORWARD, TrackPlayer.CAPABILITY_JUMP_BACKWARD ], notificationCapabilities: [ TrackPlayer.CAPABILITY_PLAY, TrackPlayer.CAPABILITY_PAUSE, TrackPlayer.CAPABILITY_STOP, TrackPlayer.CAPABILITY_JUMP_FORWARD, TrackPlayer.CAPABILITY_JUMP_BACKWARD ] }); };
same issue here