-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
73 lines (71 loc) · 2.08 KB
/
App.tsx
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import {useEffect} from 'react';
import TrackPlayer, {
AppKilledPlaybackBehavior,
Capability,
RepeatMode,
} from 'react-native-track-player';
import Navigation from './routes/';
import PlayerProvider from './context/PlayerProvider';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import AuthProvider from './context/AuthProvider';
import Toast from './components/toast/Toast';
import React from 'react';
import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';
export default function App() {
useEffect(() => {
const setupPlayer = async () => {
try {
await TrackPlayer.setupPlayer({
autoHandleInterruptions: true,
maxCacheSize: 1024 * 10,
});
await TrackPlayer.setRepeatMode(RepeatMode.Queue);
await TrackPlayer.setVolume(1);
await TrackPlayer.updateOptions({
progressUpdateEventInterval: 1,
capabilities: [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
Capability.SeekTo,
],
compactCapabilities: [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
],
notificationCapabilities: [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
Capability.SeekTo,
],
android: {
appKilledPlaybackBehavior:
AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification,
alwaysPauseOnInterruption: true,
stopForegroundGracePeriod: 0,
},
});
} catch (e) {
console.log(e);
}
};
setupPlayer();
}, []);
return (
<AuthProvider>
<PlayerProvider>
<GestureHandlerRootView>
<BottomSheetModalProvider>
<Navigation />
</BottomSheetModalProvider>
<Toast />
</GestureHandlerRootView>
</PlayerProvider>
</AuthProvider>
);
}