Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import React, {Component} from 'react';
  2. import {Dimensions, Text, View} from "react-native"
  3. import Video from "react-native-video";
  4.  
  5. const {height, width} = Dimensions.get("window")
  6.  
  7. const videoHeight = height / 1.8;
  8. const videoWidth = width;
  9.  
  10.  
  11. class VideoDemo extends Component {
  12. constructor(props) {
  13. super(props);
  14. this.state = {
  15. paused: true,
  16. }
  17. }
  18.  
  19. render() {
  20. const {videoURL} = this.props
  21.  
  22. return (
  23. <View style={{
  24. height:height - 200, width:width,backgroundColor:"black"
  25. }}>
  26. <Video
  27. paused={this.state.paused}
  28. source={{uri: videoURL}}
  29. style={{height: videoHeight, width: videoWidth}}
  30. resizeMode={'cover'}
  31. >
  32. </Video>
  33. </View>
  34. );
  35. }
  36.  
  37. playVideo = () => {
  38. this.setState({
  39. paused: false
  40. })
  41. }
  42.  
  43. pausedVideo = () => {
  44. this.setState({
  45. paused: true
  46. })
  47. }
  48. }
  49.  
  50. export default VideoDemo;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement