react-native-video-player icon indicating copy to clipboard operation
react-native-video-player copied to clipboard

Video Player Orientation Incorrect with <= KitKat OS devices

Open ghostknow opened this issue 7 years ago • 1 comments

Anyone have idea to solve this problem?

ghostknow avatar Sep 02 '18 14:09 ghostknow

Hey @ghostknow -

Pretty sure I just ran into this exact same issue on iPhone X's.

Looking at the package's default props, it's defaulting videos to a particular size which may not be right. I had to get my screens dimensions then pass that in as those props to correct the issue.

Here is a rough idea of what I did:

import React, {PureComponent} from 'react';
import {View} from 'react-native'
Import {View, Dimensions} from 'react-native';
import VideoPlayer from 'react-native-video-player';

const dimensions = Dimensions.get('window');

class MyVideoWrapper extends PureComponent {
  	state = {
		width: dimensions.width,
		height: dimensions.height
	};

       render() {
              <View onLayout=this.updateLayout}>
                     <VideoPlayer
                            video={{uri: yourSource}}
                            videoHeight={parseInt(this.state.height, 10)}
                            videoWidth={parseInt(this.state.width, 10)}
                     />
              </View>
       }

       updateLayout = () => {
              const {width, height} = Dimensions.get('window');
              this.setState({width, height});
       }
}

petrogad avatar Sep 26 '18 18:09 petrogad