-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.jsx
75 lines (66 loc) · 2 KB
/
App.jsx
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
74
75
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React from 'react';
import { Platform, PermissionsAndroid } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomeScreen from './Home';
import PlayScreen from './PlayScreen';
import PublishScreen from './PublishScreen';
import { NodeMediaClient } from 'react-native-nodemediaclient';
const Stack = createNativeStackNavigator();
const requestPermission = async () => {
try {
let granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.CAMERA,
{
title: 'Cool LiveStream App Camera Permission',
message:
'Cool LiveStream App needs access to your camera',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('You can use the camera');
} else {
console.log('Camera permission denied');
}
granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
{
title: 'Cool LiveStream App Microphone Permission',
message:
'Cool LiveStream App needs access to your microphone',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
},
);
} catch (err) {
console.warn(err);
}
};
function App() {
if (Platform.OS === 'ios') {
NodeMediaClient.setLicense("");
} else {
requestPermission();
NodeMediaClient.setLicense("");
}
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="iShow" component={HomeScreen} />
<Stack.Screen name="Live Play" component={PlayScreen} />
<Stack.Screen name="Live Publish" component={PublishScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;