Skip to content

Instantly share code, notes, and snippets.

@adhithiravi
Created August 16, 2018 19:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adhithiravi/e17d409c6cc412f2fa31b313215edb04 to your computer and use it in GitHub Desktop.
Save adhithiravi/e17d409c6cc412f2fa31b313215edb04 to your computer and use it in GitHub Desktop.
VideoComponent.js
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { View, StyleSheet } from 'react-native'
import Video from 'react-native-video'
export default class VideoComponent extends React.Component {
renderVideo () {
return(
<Video
source={require('./assets/Piano_Playing_Close.mp4')}
style={{ width: 800, height: 800 }}
muted={true}
repeat={true}
resizeMode={"cover"}
volume={1.0}
rate={1.0}
ignoreSilentSwitch={"obey"}
/>
)
}
render () {
return (
<View>
{this.renderVideo()}
</View>
)
}
}
// Later on in your styles..
var styles = StyleSheet.create({
backgroundVideo: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment