-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
79 lines (72 loc) · 1.74 KB
/
App.js
File metadata and controls
79 lines (72 loc) · 1.74 KB
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
76
77
78
79
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, { Component } from 'react';
import {
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Button,
NativeModules
} from 'react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
import Video from 'react-native-video';
const { VideoPlayerManager } = NativeModules;
const url = 'https://www.w3schools.com/html/mov_bbb.mp4';
class App extends Component {
player = null;
fullScreen = () => {
if (Platform.OS === 'android') {
VideoPlayerManager.showVideoPlayer(url);
} else if (this.player) {
this.player.presentFullscreenPlayer();
}
}
render () {
return (<>
<StatusBar barStyle="dark-content" />
<ScrollView contentInsetAdjustmentBehavior="automatic" style={styles.scrollView}>
<View style={styles.body}>
<Text style={styles.sectionTitle}>video</Text>
</View>
<Video
source={{uri: url }}
style={{width: 250, height: 250 }}
onFullscreenPlayerDidDismiss={this.stopVideo}
ref={(ref) => {
this.player = ref;
}}
/>
<Button onPress={this.fullScreen} style={{backgroundColor: 'blue'}} color={'blue'} title={'fullScreen'}></Button>
</ScrollView>
</>)
}
}
const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter,
},
body: {
padding: 16,
backgroundColor: Colors.white,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black,
},
backgroundVideo: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
},
});
export default App;