react-native-dlvideo
Version:
76 lines (68 loc) • 1.81 kB
JavaScript
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View
} from 'react-native';
import KSYVideo from 'react-native-dlvideo'
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
export default class App extends Component<{}> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<KSYVideo
ref={(video)=>{this.video = video}}
source={{uri:'rtmp://live.hkstv.hk.lxdns.com/live/hks'}}
timeout={{prepareTimeout:60, readTimeout:60}}
bufferSize={30}
bufferTime={4}
controls={true}
onEnd={(data)=>{this.props.navigation.goBack();console.log("JS onCompletion");}}
onError={(data)=>{this.props.navigation.goBack();console.log("JS onError" + data.what + data.extra);}}
onReadyForDisplay = {(data)=>{console.log("JS Video render start");}}
style={styles.fullScreen}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
fullScreen: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
backgroundColor: 'black',
},
});