React-native-track-player: My notifications buttons don't work

Created on 18 Nov 2019  路  3Comments  路  Source: react-native-kit/react-native-track-player

Configuration

react-native: 0.61.4
What react-native-track-player version are you using? Last

Issue

Code

index.js

AppRegistry.registerComponent(appName, () => App);
TrackPlayer.registerPlaybackService(() => require('./tracker-service'));
TrackPlayer.setupPlayer().then(() => {});

TrackPlayer.updateOptions({
stopWithApp: true,

capabilities: [
TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_STOP,
TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
TrackPlayer.CAPABILITY_SEEK_TO,
],
compactCapabilities: [
TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
]
});

tracker-service.js

import TrackPlayer from 'react-native-track-player';

module.exports = async function () {
TrackPlayer.addEventListener('remote-play', () => TrackPlayer.play());

TrackPlayer.addEventListener('remote-pause', () => TrackPlayer.pause());

TrackPlayer.addEventListener('remote-stop', () => TrackPlayer.destroy());

}

All 3 comments

Please, can you describe what is not working? Does the notification doesn't show up? Are the buttons not visible? Are the buttons not being triggered when pressed? Which platform are you experiencing the issue?

@Guichaguri The buttons are appearing normally, but it's as if the notification buttons don't trigger the events.

Just restarting the project that went back to work, forgive my slowness: c

Was this page helpful?
0 / 5 - 0 ratings