react-native-video/examples/video-caching/App.ios.js

49 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-02-28 05:56:43 -07:00
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from "react";
2018-03-01 15:51:30 -07:00
import { StyleSheet, Text, View, Dimensions } from "react-native";
import Video from "react-native-video";
const { height, width } = Dimensions.get("screen");
2018-02-28 05:56:43 -07:00
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
2018-03-01 15:51:30 -07:00
<Video
source={{
uri:
"https://rawgit.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4"
}}
ref={player => {
this.player = player;
}}
onEnd={() => {
this.player.seek(0);
}}
style={{ flex: 1, height, width }}
/>
2018-02-28 05:56:43 -07:00
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF"
},
welcome: {
fontSize: 20,
textAlign: "center",
margin: 10
}
});