|
|
@@ -1,94 +1,21 @@
|
|
|
import React, { Component } from 'react';
|
|
|
-import {
|
|
|
- StyleSheet,
|
|
|
- Text,
|
|
|
- View,
|
|
|
- ScrollView
|
|
|
-} from 'react-native';
|
|
|
+import { Provider } from 'react-redux';
|
|
|
+import { createStore, applyMiddleware } from 'redux';
|
|
|
+import ReduxThunk from 'redux-thunk';
|
|
|
|
|
|
-import Video from 'react-native-video';
|
|
|
-import Canvas from './components/Canvas';
|
|
|
-import Socket from './components/Socket';
|
|
|
-import Chat from './components/Chat';
|
|
|
-
|
|
|
-class LiveVideo extends Component {
|
|
|
- state = { pdf: "EBA", diapo: 1, messages: [] };
|
|
|
- getTime() {
|
|
|
- var d = new Date();
|
|
|
- var curr_hour = d.getHours();
|
|
|
- var curr_min = d.getMinutes();
|
|
|
- if (curr_min < 10)
|
|
|
- curr_min='0'+curr_min;
|
|
|
- return curr_hour+":"+curr_min;
|
|
|
- }
|
|
|
-
|
|
|
- onMessage(user,text) {
|
|
|
- this.setState({messages: [ ...this.state.messages, { time: this.getTime(), user, text }] });
|
|
|
- }
|
|
|
-
|
|
|
- onDiapoChanged(pdf, diapo) {
|
|
|
- console.log("Diapo changed!", pdf, diapo);
|
|
|
- this.setState({ pdf, diapo });
|
|
|
- }
|
|
|
+import Router from './Router';
|
|
|
+import LiveVideo from './components/LiveVideo';
|
|
|
+import reducers from './reducers';
|
|
|
|
|
|
+class App extends Component {
|
|
|
render() {
|
|
|
+ const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
|
|
|
return (
|
|
|
- <View style={{flex:1}}>
|
|
|
- <ScrollView
|
|
|
- horizontal={true}
|
|
|
- pagingEnabled={true}
|
|
|
- >
|
|
|
- <View style={styles.videoPage}>
|
|
|
- <View style={styles.video}>
|
|
|
- <Video source={{ uri: "https://plataforma.especificosba.com.ar/hls/movie.m3u8" }}
|
|
|
- ref={(ref) => { this.player = ref }}
|
|
|
- playInBackground={true}
|
|
|
- volume={0.2}
|
|
|
- resizeMode={"contain"}
|
|
|
- style={{position:'absolute', top: 0, left: 0, right: 0, bottom:0}}
|
|
|
- />
|
|
|
- </View>
|
|
|
- <View style={styles.imageContainer}>
|
|
|
- <Canvas pdf={this.state.pdf} diapo={this.state.diapo} style={{flex:1}}/>
|
|
|
- </View>
|
|
|
-
|
|
|
- </View>
|
|
|
-
|
|
|
- <View style={{flex:1,width:700}}>
|
|
|
- <Chat messages={this.state.messages} />
|
|
|
- </View>
|
|
|
-
|
|
|
- </ScrollView>
|
|
|
- <Socket onDiapoChanged={this.onDiapoChanged.bind(this)} onMessage={this.onMessage.bind(this)} />
|
|
|
- </View>
|
|
|
-
|
|
|
+ <Provider store={store}>
|
|
|
+ <Router />
|
|
|
+ </Provider>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const styles = StyleSheet.create({
|
|
|
- videoPage: {
|
|
|
- flexDirection: 'row',
|
|
|
- flex: 1
|
|
|
- },
|
|
|
- video: {
|
|
|
- width: 320,
|
|
|
- justifyContent: 'center',
|
|
|
- alignItems: 'center',
|
|
|
- backgroundColor: '#F5FCFF',
|
|
|
- margin: 5
|
|
|
-
|
|
|
- },
|
|
|
- imageContainer: {
|
|
|
- width: 320,
|
|
|
- margin: 5
|
|
|
- },
|
|
|
- instructions: {
|
|
|
- textAlign: 'center',
|
|
|
- color: '#333333',
|
|
|
- marginBottom: 5,
|
|
|
- },
|
|
|
-});
|
|
|
-
|
|
|
-
|
|
|
-export default LiveVideo;
|
|
|
+export default App;
|