-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAppEntry.js
41 lines (34 loc) · 1.38 KB
/
AppEntry.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
36
37
38
39
40
41
import "react-native-gesture-handler";
import { logger } from "react-native-logs";
import { registerRootComponent } from "expo";
import TrackPlayer, { Capability, IOSCategory, IOSCategoryOptions } from "react-native-track-player";
import App from "./App";
import User from "@backend/user";
import Local from "@backend/local";
import Social from "@backend/social";
import Downloads from "@backend/downloads";
import { PlaybackService } from "@backend/player";
const log = logger.createLogger();
registerRootComponent(App);
TrackPlayer.registerPlaybackService(() => PlaybackService);
(async() => {
User.setup();
Local.setup()
.catch(error => log.error("Unable to set up local storage", error));
Downloads.setup()
.catch(error => log.error("Encountered error while setting up downloads", error));
await TrackPlayer.setupPlayer({
iosCategory: IOSCategory.Playback,
iosCategoryOptions: [
IOSCategoryOptions.MixWithOthers, IOSCategoryOptions.MixWithOthers,
IOSCategoryOptions.AllowAirPlay, IOSCategoryOptions.AllowBluetooth
]
});
await TrackPlayer.updateOptions({
capabilities: [
Capability.Play, Capability.Pause, Capability.SkipToNext, Capability.SkipToPrevious,
Capability.SeekTo, Capability.Stop
],
compactCapabilities: [Capability.Play, Capability.Pause]
});
})();