1// Load the module
2
3import Video from 'react-native-video';
4
5// Within your render function, assuming you have a file called
6// "background.mp4" in your project. You can include multiple videos
7// on a single screen if you like.
8
9<Video source={{uri: "background"}} // Can be a URL or a local file.
10 ref={(ref) => {
11 this.player = ref
12 }} // Store reference
13 onBuffer={this.onBuffer} // Callback when remote video is buffering
14 onError={this.videoError} // Callback when video cannot be loaded
15 style={styles.backgroundVideo} />
16
17// Later on in your styles..
18var styles = StyleSheet.create({
19 backgroundVideo: {
20 position: 'absolute',
21 top: 0,
22 left: 0,
23 bottom: 0,
24 right: 0,
25 },
26});
1import React from 'react';
2import {View} from 'react-native';
3import YoutubePlayer from 'react-native-youtube-iframe';
4
5const App = () => {
6
7 return (
8 <View>
9 <YoutubePlayer
10 height={300}
11 play={true}
12 videoId={'84WIaK3bl_s'}
13 />
14 </View>
15 );
16};