我正在使用 Expo av 结合平面列表在我的应用程序的学习部分呈现一堆视频。
由于某种原因,一些视频在初始加载后开始消失(就像你看到视频的封面突然消失了,你可以看到视频的空白处但那里什么都没有显示)。
此外,我应该提到,这在模拟器上运行良好,并且仅在物理设备上发生,如果您清除应用程序的捕获并在开始时再次加载它,它会显示视频并再次开始消失。
这是我的代码:
<FlatList
data={learnVideo?.data}
keyExtractor={(item, index) => index.toString()}
scrollEnabled
refreshing={refreshing}
onRefresh={onRefresh}
renderItem={({ item }) => {
return (
<>
<View>
<TouchableOpacity
style={{
//alignItems: "center",
paddingVertical: 20,
borderColor: "#363C57",
borderWidth: 1,
flexDirection: "column",
}}
>
<Video
ref={video}
useNativeControls
resizeMode="cover"
isLooping={false}
progressUpdateIntervalMillis="500"
loadAsync={(downloadFirst = true)}
style={{
width: "90%",
height: 150,
alignSelf: "center",
}}
source={{ uri: item.video }}
/>
<Text
style={{
color: "white",
fontSize: 20,
fontWeight: "500",
marginLeft: 20,
textAlign: "left",
paddingTop: 20,
}}
>
{item.title}
</Text>
</TouchableOpacity>
</View>
</>
);
}}
/>
任何帮助将不胜感激。