我有一个视频播放器,下面有一个视频缩略图列表,我正在分页以更新该列表。当新视频添加到我的状态并且视频暂停时,该组件会重新渲染,并且由于默认情况下设置了自动播放,因此视频会从暂停状态开始播放。
我尝试使用shouldComponentUpdate并手动尝试管理某些状态,以作为无济于事的解决方法。
<VideoPlayer
navigator={this.props.navigator}
toggleResizeModeOnFullscreen={false}
repeat
disableFullscreen
ignoreSilentSwitch="ignore"
disableVolume
ref={ref => {
this.videoPlayer = ref;
}}
source={{ uri: downloadUrl }}
rate={1.0}
volume={1.0}
resizeMode="contain"
style={styles.video}
onEnd={this.playNextShortShift}
onVideoError={this.onVideoError}
/>
</View>
{this.state.orientation === 'portrait' && (
<View style={{ flex: 1 }}>
<View style={styles.videoPlayerTextContainer}>
<View style={{ height: 12 }} />
<Text style={styles.videoTitleText}>NOW PLAYING:</Text>
<View style={{ height: 4 }} />
<Text style={styles.videoTitleText}>{title}</Text>
</View>
<FlatList
ref={flatList => {
this.flatList = flatList;
}}
bounces={false}
style={{ flex: 0 }}
getItemLayout={this.getItemLayout}
horizontal={false}
data={data}
initialNumToRender={data.length}
extraData={this.state}
renderItem={({ item, index }) => this.renderEntry(item, index)}
keyExtractor={(item, index) => index}
onEndReached={this.handleLoadMore}
onEndReachedThreshold={0.5}
onMomentumScrollBegin={() => {
this.onEndReachedCalledDuringMomentum = false;
}}
/>
</View>```
How can update the thumbnail list and maintain the same video player state? Specifically when paused.
Thanks!