I’m at present constructing an app in React Native with Expo and I need to have a display screen the place I show a video. I’m at present making an attempt to do this with Expo Video but it surely is not going that nicely. Right here is the code of the display screen:
operate VideosScreen({ navigation }) {
const video = React.useRef(null);
const [status, setStatus] = React.useState({});
return (
<SafeAreaView>
<View>
<Video
ref={video}
fashion={types.video}
supply={require("./belongings/Movies/AS-Video.mp4")}
useNativeControls
resizeMode={ResizeMode.CONTAIN}
isLooping
onPlaybackStatusUpdate={(standing) => setStatus(() => standing)}
/>
<View fashion={types.buttons}>
<Button
title={standing.isPlaying ? "Pause" : "Play"}
onPress={() =>
standing.isPlaying
? video.present.pauseAsync()
: video.present.playAsync()
}
/>
</View>
</View>
</SafeAreaView>
);
}
I’ve no errors, and the web page appears like this:
If I press play the video does play (I can hear the sound) and it does pause however the video simply does not present up.
This code has been simply copy pasted from their doc about it https://docs.expo.dev/variations/newest/sdk/video/.
For my second challenge, after I exit out of this display screen (both use the ui up high or create a separate button) it crashes my app after about 1s. I attempted linking the button to a number of different screens with the identical end result.
Thanks upfront on your assist.
I’ve tried to hyperlink the massive buck bunny video as an alternative with the identical actual end result.
I’ve double checked the video format and it’s certainly .mp4.