Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

how to stream a streamable video from a google storage bucket with expo-av video element on react native

$
0
0

I need to stream a video with the expo-av video component on react native.

The issue I'm having is that it has to download the entire video before it starts playing.

It needs to stream the video and play immediately and not after it downloads the video first

Video component

<Video  ref={video}  source={{uri:viewOptionsVideoURL}}              style={{ width:windowWidth, height: "50%"}}  resizeMode={ResizeMode.STRETCH}  isLooping  useNativeControls  onPlaybackStatusUpdate={status => setStatus(() => status)}  rate={1.0}  volume={1.0}  isMuted={false}  onLoad={(status: AVPlaybackStatus)=>{      console.log(status);  }}  onError={console.log}/>

Calling Code

// this will set the video url on the above component using the useState hooksetViewOptionsVideoURL("https://storage.googleapis.com/clipdrop-prod/tfNttNC2RLuuxJ_VdWKKcJkm1.amgZR6y_460sv.mp4");// these 2 will load and start playing the video from position 0await (video?.current as any).loadAsync();await (video?.current as any).playFromPositionAsync(0);

Not sure what else to do, as I would like it to start playing as soon as its loaded as the above invocation of the video using loadAsync()


Viewing all articles
Browse latest Browse all 6290

Trending Articles