From 3e72bfa56c860826429a842f6c128d78d4a930db Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 1 Jun 2017 19:47:08 -0400 Subject: react-native-web port of fmf app --- client/src/lib/views/livestream.js | 134 +++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 client/src/lib/views/livestream.js (limited to 'client/src/lib/views/livestream.js') diff --git a/client/src/lib/views/livestream.js b/client/src/lib/views/livestream.js new file mode 100644 index 0000000..d3df460 --- /dev/null +++ b/client/src/lib/views/livestream.js @@ -0,0 +1,134 @@ +import React, { Component } from 'react'; +import { + StyleSheet, + View +} from 'react-native'; + +import Container from '../components/container' +import ClearText from '../components/text' +import Button from '../components/button' +import Youtube from '../components/youtube' + +export default class Livestream extends Component { + constructor(props) { + super() + this.state = { + ytid: getYTID(choice(props.content.streams).uri), + isReady: false, + currentTime: 0, + duration: 0, + quality: 0, + status: 'unloaded', + error: null, + } + } + render() { + const buttons = this.props.content.streams.map( (stream, i) => { + const ytid = getYTID(stream.uri || "") + if (! ytid) return null + let buttonStyle, textStyle + if (ytid === this.state.ytid) { + buttonStyle = styles.activeButton + textStyle = styles.activeButtonText + } + return ( +