forked from Vinnih-1/Musy-Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (24 loc) · 1001 Bytes
/
index.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
import { AppRegistry } from 'react-native'
import App from './src/App'
import { name as appName } from './app.json'
import TrackPlayer, { AppKilledPlaybackBehavior, Capability, Event } from 'react-native-track-player'
import { PlaybackService } from './src/services/PlaybackService'
AppRegistry.registerComponent(appName, () => App)
TrackPlayer.registerPlaybackService(() => PlaybackService)
TrackPlayer.setupPlayer().then(() => {
TrackPlayer.addEventListener(Event.RemoteNext, () => TrackPlayer.skipToNext())
TrackPlayer.addEventListener(Event.RemotePrevious, () => TrackPlayer.skipToPrevious())
TrackPlayer.updateOptions({
capabilities: [
Capability.Play,
Capability.Stop,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious
],
compactCapabilities: [ Capability.Play, Capability.Pause, Capability.SkipToNext, Capability.SkipToPrevious ],
android: {
appKilledPlaybackBehavior: AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification
}
})
})