Video not loading when setting source uri with state


#1

The below code fails to load video (no error but just blank screen). uri is passed from different screen using navigation params.

----------------------code-----------------------------

import { Video } from 'expo';

...

componentDidMount(){
    const { navigation } = this.props;
    const data = navigation.getParam('uri', 'null');
    this.setState({uri: data});
  }

...

render() {
return (
...
<Video 
            source={{uri: this.state.uri}}
            style={{width: this.deviceWidth, height: 300}}
            shouldPlay
            isLooping
            resizeMode="cover"
          />
...
)}

#2

Can you create a reproducible example on snack.expo.io ? That would help us run your code and see if we can find an issue.


#3

Thank you for our reply!

This is my snack: https://snack.expo.io/HkeR9ylZQ

I want to record video using “Camera” screen. Then replay the recorded video in the “Upload” screen.
The expected steps/outcomes are:

  1. Click on “Camera” in the bottom tab.
  2. Record a video
  3. after recording is stopped, the screen moves to “Upload” screen
  4. recorded video should play in the upload screen.