Video url returned by expo-camera when embedded in Video Component of expo-av gives blank screen

193 views Asked by At

I tried to capture a video using expo-camera, once recorded a video, as we get a uri of video i used that uri to show a preview,to show preview i used video component of expo - av, But Video component is showing blank screen. Could anyone suggest a fix?

  const takeVideo = async ()=>{
  
    if(cameraRef)
    {
        setIsRecording(true);
      
       
        let res = await cameraRef.recordAsync();
        
       
        console.log(res);

        setVideoUri(res.uri);
        setVideoModalVisible(true);
        setIsRecording(false);

        
    }

  }


  const VideoPreview = (props)=>{

   
    return (
      
       <Modal visible={videoModalVisible}>
       <View style={{ flex: 1, margin: 50, paddingTop: 20, flexDirection: "column", justifyContent: "flex-start", alignItems: "center", backgroundColor: "white" }}>
 
 
       <Video
        source={{ uri: videoUri }}
        rate={1.0}
        volume={1.0}
        isMuted={false}
        resizeMode="cover"
        shouldPlay = {false}
        isLooping = {false}
      
        useNativeControls
        style={{width:width*0.75,height:height*0.5}}
      />
         <View style={{ flexDirection: "column" }}>
 
           <Button mode="contained" style={{ margin: 5 }} onPress={() => { sendFile(videoUri,"video"); }}>Send</Button>
 
           <Button mode="contained" style={{ margin: 5 }} onPress={() => { setVideoModalVisible(false) }}>Close</Button>
 
         </View>
 
 
       </View>
 
     </Modal>
 
    );

  }

These are the codes that i used.Please some one suggest a fix.

0

There are 0 answers