how to fix TypeError: Cannot read property 'Constants' of null in react-native-video

270 Views Asked by At

I'm encountering an error in my React Native project when using the react-native-video component. The error message is as follows:

ERROR  TypeError: Cannot read property 'Constants' of null

This error occurs in the Video component my code->


import React, { useRef, useState } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import Video from 'react-native-video';

const App = () => {

  const videoRef = useRef(null);

  const onBuffer = (e) => {
    console.log('buffering..', e);
  };

  const onError = (e) => {
    console.log('error..', e);
  };

 

  return (
    <View style={styles.container}>
    
        <Video
          source={{
            uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4',
          }}
          ref={(ref) => {
            videoRef.current = ref;
          }}
          onBuffer={onBuffer}
          onError={onError}
    
          style={styles.backgroundVideo}
        />
    
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  backgroundVideo: {
    position: 'absolute',
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
  },
});

export default App;

I've included the complete error stack trace, but I'm not sure where and how to fix it. Can someone help me identify the issue and suggest a solution? I appreciate any guidance or insights into resolving this problem.

0

There are 0 best solutions below