我准备了一个应用程序,我需要从数据文件中获取视频链接。我能为此做些什么。
来源={{ ? }} 以及如何使用 flatlist 将 4 个视频投影到屏幕上?谢谢
export const data = [
{
id: 1,
name: "Video1",
video: "http://example.com/video1.mp4" -> ***how do i do this***
},
{
id: 2,
name: "Video2",
video: "http://example.com/video2.mp4" -> ***how do i do this***
},
{
id: 3,
name: "Video3",
video: "http://example.com/video3.mp4" -> ***how do i do this***
},
];
return (
<View style={styles.container}>
<Video
ref={video}
style={{ alignSelf: "center", width: 320, height: 200 }}
source={{ ? }}
useNativeControls
resizeMode="contain"
isLooping
onPlaybackStatusUpdate={(status) => setStatus(() => status)}
/>
示例图片:我想要一个像这里写的代码一样的视频代码:)
export const data = [
{
id: 1,
name: "image1",
image: "../assets/image/sun.png"
},
];
import data from './data';
function App() {
return (
<View>
<Image source={data.image}/>
</View)
}