|
|
@@ -0,0 +1,74 @@
|
|
|
+import React, { Component } from 'react';
|
|
|
+import { Text, ListView, View } from 'react-native';
|
|
|
+import { Card, CardSection, Button } from '../../components/common';
|
|
|
+import Header from './Header';
|
|
|
+import Video from 'react-native-video';
|
|
|
+import VideoPlayer from 'react-native-video-controls';
|
|
|
+
|
|
|
+class Videos extends Component {
|
|
|
+
|
|
|
+ componentWillMount() {
|
|
|
+ this.createDataSource(this.props);
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ this.createDataSource(nextProps);
|
|
|
+ }
|
|
|
+
|
|
|
+ createDataSource({ videos }) {
|
|
|
+ const ds = new ListView.DataSource({
|
|
|
+ rowHasChanged: (r1, r2) => r1 !== r2
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(videos);
|
|
|
+ this.dataSource = ds.cloneWithRows(videos);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ renderHeader() {
|
|
|
+ return <Header titulo={this.props.titulo} profesor={this.props.profesor} fecha={this.props.fecha} />;
|
|
|
+ }
|
|
|
+ playVideo(id) {
|
|
|
+ console.log("Playing", id);
|
|
|
+ this.refs.youtubePlayer.videoId = id;
|
|
|
+ //player.play = true;
|
|
|
+ this.refs.youtubePlayer.seekTo(1);
|
|
|
+ }
|
|
|
+ renderVideo({ video, titulo }) {
|
|
|
+ console.log(video, titulo);
|
|
|
+
|
|
|
+ return ( <Text onPress={this.playVideo.bind(this, video) }>{titulo}</Text> );
|
|
|
+ }
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ <View>
|
|
|
+ <ListView
|
|
|
+ dataSource={this.dataSource}
|
|
|
+ renderRow={this.renderVideo.bind(this)}
|
|
|
+ />
|
|
|
+ <VideoPlayer
|
|
|
+ source={{ uri: 'https://f001.backblazeb2.com/file/videos-storage/test.mp4' }}
|
|
|
+ ref={(ref) => { this.player = ref; }}
|
|
|
+ volume={1}
|
|
|
+ resizeMode={'contain'}
|
|
|
+ videoStyle={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}
|
|
|
+ navigator={ this.props.navigator }
|
|
|
+ rate={ 1 }
|
|
|
+ controlTimeout={ 15000 }
|
|
|
+ resizeMode="cover"
|
|
|
+ playInBackground={true}
|
|
|
+ playWhenInactive={true}
|
|
|
+
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const styles = {
|
|
|
+ texto: {
|
|
|
+ fontSize: 12,
|
|
|
+ }
|
|
|
+}
|
|
|
+export default Videos;
|