-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (46 loc) · 1.79 KB
/
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
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
import React, { Component } from 'react';
import { AppRegistry, Platform, StatusBar } from 'react-native';
import TrackPlayer from 'react-native-track-player';
import RNUxcam from 'react-native-ux-cam';
import { Provider } from 'react-redux';
import Player from './src/components/player';
import createEventHandler from './src/redux/event-handler';
import store from './src/redux/store';
if (Platform.OS === 'android') {
// RNUXCam is incomaptible with current dependencies on iOS
RNUxcam.optIntoSchematicRecordings(); // this initializes rec
RNUxcam.startWithKey('egfdnzk1wgo5nse'); // api key
}
export default class App extends Component {
componentDidMount = async () => {
const capabilitiesList = [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
];
const state1 = await TrackPlayer.getState();
await TrackPlayer.setupPlayer({
// Can set maxCacheSize like this:
// maxCacheSize: 1024 * 5, // 5 mb
});
const state = await TrackPlayer.getState();
// necessary for setting capabilities
TrackPlayer.updateOptions({
// TODO: set up custom background play controls styling, e.g.
// icon: <album art>
// docs on that here: https://github.com/react-native-kit/react-native-track-player/wiki/Documentation#player-functions
capabilities: capabilitiesList,
compactCapabilities: capabilitiesList,
notificationCapabilities: capabilitiesList,
});
}
render = () => (
<Provider store={store}>
<StatusBar translucent backgroundColor='rgba(0,0,0,0.00)' />
<Player />
</Provider>
)
}
AppRegistry.registerComponent('mood_mobile', () => App);
TrackPlayer.registerEventHandler(createEventHandler(store));