我正在我的代码中实现React-Native-Video-Processing。 测试代码后,我将无法在屏幕上看到Videoplayer。 没有视频时仅播放音频。 我不确定为什么不显示Videoplayer。
“反应”:“ 16.6.3”, “ react-native”:“ 0.58.5”, “ react-native-video-processing”:“ ^ 1.20.0”
这是我的代码
<View style={{flex: 1}} onLayout={this.onLayout} >
<VideoPlayer
ref={ref => this.videoPlayerRef = ref}
play={true} // default false
replay={true} // should player play video again if it's ended
rotate={true} // use this prop to rotate video if it captured in landscape mode iOS only
source={this.props.url}
playerWidth={width} // iOS only
playerHeight={height} // iOS only
style={styles.backgroundColor}
bbackground_Color={'black'}
onChange={({ nativeEvent }) => console.log({ nativeEvent })} // get Current time on every second
/>
</View>
我已经用Android测试了我的代码,但我只希望它适用于Android,而不是ios。 你能帮我吗?
答案 0 :(得分:0)
请提及视频播放器的宽度和高度。
style={{height: Dimensions.get("window").height, width:Dimensions.get("window").width}}
或在下面找到完整的代码
<VideoPlayer
ref={ref => this.videoPlayerRef = ref}
startTime={30} // seconds
endTime={120} // seconds
play={true} // default false
replay={true} // should player play video again if it's ended
rotate={true} // use this prop to rotate video if it captured in landscape mode iOS only
source={this.state.video.uri}
playerWidth={300} // iOS only
playerHeight={500} // iOS only
style={{ backgro`enter code here`undColor: 'black' }}
resizeMode={VideoPlayer.Constants.resizeMode.COVER}
style={{height: Dimensions.get("window").height, width:Dimensions.get("window").width}}
onChange={({ nativeEvent }) => console.log({ nativeEvent })} // get Current time on every second
/>