Problem
I’m using the Video
component for a my React-Native application.
I’ve following the Official documents for using it, but it’s not work.
Reproduction
When I set the source prop as like as a example:
<Video
key={`video${idx}`}
style={styles.video}
source={{
uri: "https://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4",
}}
useNativeControls
resizeMode="contain"
isLooping
/>
It’s work normally.
But when I using the uri with my own url provided by a Fast-api server,
<Video
...(same)
source={{
uri: "http://localhost:8000/getfrontvideo/?filename='A-13_3_1667031414177-front.webm'",
}}
(same)...
/>
It’s not work.
Questions
The Browser Test
- Both of URLs are response by
.mp4
video, and can play with browser. Why my URL is not work?
The Encoding Test
- If I download the
big_buck_bunny.mp4
video that normally played in the example, and response it by fast-api server,
The app can’t read it again. What’s wrong with my server?
Codes and Screenshot
-
app(React Native):
<ScrollView style={{ width: "100%", height: "100%" }}> <View style={{ widht: "100%", height: 30 }}> <Text style={{ fontSize: 24 }}>22년 10월</Text> </View> <View style={styles.videoWrapper}> {videos?.map((video, idx) => { return ( <Video key={`video${idx}`} style={styles.video} source={{ // uri: "https://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4", // work uri: "http://localhost:8000/getfrontvideo/?filename='A-13_3_1667031414177-front.webm'", // doesn't work }} useNativeControls resizeMode="contain" isLooping /> ); })} </View> </ScrollView>
-
The “Network” tap of developer console