react-native-video-player
react-native-video-player copied to clipboard
Video Player Orientation Incorrect with <= KitKat OS devices
Anyone have idea to solve this problem?
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});
}
}