我正在使用react-native-video
。
<Video
source={require('../../assets/imgs/video.mp4')}
ref={(ref) => { this.player = ref }}
repeat={true}
resizeMode="contain"
style={{
width: this.state.screenWidth,
height: this.state.heightScaled
}}
onLoad={response => {
const { width, height } = response.naturalSize;
const heightScaled = height * (this.state.screenWidth / width);
this.setState({ heightScaled: heightScaled });
}}
/>
这是我尝试过https://github.com/react-native-community/react-native-video/issues/746的一种解决方案,但不适用于我。有人可以告诉我如何使我的视频适合特定的高度吗?