-
Notifications
You must be signed in to change notification settings - Fork 0
/
Container.js
132 lines (104 loc) · 2.6 KB
/
Container.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import React, {Component} from 'react';
import { StyleSheet, Text, View, Button ,Alert,Dimensions ,TouchableOpacity} from 'react-native';
import Video from 'react-native-video';
const windows = Dimensions.get('window');
import TimeLine from './TimeLine.js';
const GLOBAL = require('./Global');
var BackboneEvents = require('backbone-events-standalone');
window.EventBus = BackboneEvents.mixin({});
type Props = {};
export default class Container extends Component {
static navigationOptions = ({ navigation }) => {
return {
header: () => null
}
}
constructor(props) {
super(props)
this.state = {
times :0,
paused: false,
}
}
changeComponent = (component) =>{
this.setState({componentSelected: component});
}
setTime(){
}
componentDidMount() {
window.EventBus.on('yourEventName', this.yourEventHandlerFunc);
window.EventBus.on('yourEventName1', this.yourEventHandlerFunc1);
}
yourEventHandlerFunc = () =>{
this.setState({
paused: true
});
}
yourEventHandlerFunc1 = () =>{
this.setState({
paused: false
});
}
getProgress(e){
this.setState({
times: e.currentTime,
})
GLOBAL.time = this.state.times;
}
render() {
return (
<View style={styles.container}>
<View style={{ width: windows.width, height: windows.height, flexDirection: 'row' }}>
<Video
source={require('./corporate.mp4')}
ref={(ref) => {
this.player = ref
}}
paused={this.state.paused}
rate={1.0}
volume={1.0}
onLoad={() => {
this.player.seek(GLOBAL.time);
}}
muted={false}
onProgress={ e => this.getProgress(e) }
repeat
resizeMode={"cover"}
style={styles.video}
/>
<View style={styles.content}>
</View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
video: {
position: 'relative',
width : windows.width,
height : windows.height,
},
content: {
flex: 1,
marginLeft: -windows.width,
alignSelf: 'auto' ,
height: windows.height,
width : windows.width,
backgroundColor: 'rgba(0, 0, 0, 0.0)',
},
text: {
color : 'white',
fontSize: 50,
fontWeight: 'bold',
textAlign: 'center',
margin: 10,
marginTop: 150,
marginLeft: 0 ,
width : windows.width,
textAlign:'center'
},
});