Expo- av: Autoplay a video

Viewed 2057

My purpose is to play a video as background, which will start just after the app loaded,

<Video
        ref={video}
        style={styles.video}
        source={{
          uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4',
        }}
        isLooping
        resizeMode="contain"
        onPlaybackStatusUpdate={status => setStatus(() => status)}
        onLoad={() => {video.setPositionAsync(0); video.current.playAsync()}}
        
      />

It worked twice for me. Until then just remained stopped after every compiling.
What change should it require? As a background video there should be no controls visible.

1 Answers

You can add the property shouldPlay in your code, this will make the video autostart playing, then the app loads. Hope it solved the problem.

Related