-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.js
35 lines (26 loc) · 796 Bytes
/
service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* This is the code that will run tied to the player.
*
* The code here might keep running in the background.
*
* You should put everything here that should be tied to the playback but not the UI
* such as processing media buttons or analytics
*/
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-next', () => {
TrackPlayer.skipToNext()
});
TrackPlayer.addEventListener('remote-previous', () => {
TrackPlayer.skipToPrevious()
});
TrackPlayer.addEventListener('remote-stop', () => {
TrackPlayer.destroy()
});
};