/**
* 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';

export default 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();
    });

    TrackPlayer.addEventListener('remote-seek', (event) => {
        TrackPlayer.seekTo(event.position);
    });
    
}