Search code examples
react-nativevideoreact-native-video

How to Display Video with React native


Im trying to display video on react native application, but when I run the application I have the error TypeError: undefined is not an object (evaluating 'RCTVideoInstance.Constants')

I ran these commands but it doesnot work : npm install react-native-video react-native link react-native-video

And this is my code :

import React from "react";
import {View} from 'react-native';
import CustomBackground from '../Components/CustomBackground';
import Video from 'react-native-video';
import videooo from '../Images/videooo.mp4'


export default class WelcomeScreen extends React.Component{

    render(){
        return(
           <CustomBackground>
                    <View style={styles.btnWelcome}>
                        <Video source={videooo} style={styles.images} onBuffer={this.onBuffer} onEnd={this.onEnd} onError={this.videoError}/>
                    </View>
                           
            </CustomBackground>
        )
    }
}


Solution

  • try to use expo-av instead of react-native-video

    more information : https://github.com/react-native-video/react-native-video/issues/1738#issuecomment-575243702