TheWidlarzGroup / react-native-video

A <Video /> component for react-native
MIT License
7.08k stars 2.85k forks source link

TypeError: null is not an object (evaluating 'RCTVideoInstance.Constants') #1738

Closed domene96 closed 4 years ago

domene96 commented 4 years ago

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in %s.%s, the componentWillUnmount method, in Cpi (at SceneView.js:9) in SceneView (at StackViewLayout.tsx:910) in RCTView (at View.js:45) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewCard.tsx:106) in RCTView (at View.js:45) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at screens.native.js:71) in Screen (at StackViewCard.tsx:93) in Card (at createPointerEventsContainer.tsx:95) in Container (at StackViewLayout.tsx:982) in RCTView (at View.js:45) in View (at screens.native.js:101) in ScreenContainer (at StackViewLayout.tsx:394) in RCTView (at View.js:45) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewLayout.tsx:384) in PanGestureHandler (at StackViewLayout.tsx:377) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.tsx:103) in RCTView (at View.js:45) in View (at Transitioner.tsx:267) in Transitioner (at StackView.tsx:40) in StackView (at createNavigator.js:81) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (at createAppContainer.js:430)

TypeError: TypeError: null is not an object (evaluating 'RCTVideoInstance.Constants')

This happens for many different implementations of

domene96 commented 4 years ago

`import React, {Component} from 'react'; import {Text, View, Button, Image, StyleSheet, Platform, NetInfo, Alert} from 'react-native'; import Video from 'react-native-video'; import allStyles from '../css/allStylesCSS.js'; import Menu from './Menu'; import Rabbit from '../rabbit.mp4'; // import MediaControls, { PLAYER_STATES } from 'react-native-media-controls';

export default class VideoComponent extends React.Component { render () { return ( <View style={{position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center', zIndex: 9,}}> <Video source={ Rabbit } ref={(ref) => { this.player = ref }} // Store reference onBuffer={this.onBuffer} // Callback when remote video is buffering onError={this.videoError} // Callback when video cannot be loaded style={styles.backgroundVideo} resizeMode={"cover"} /> ) } }

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

CHaNGeTe commented 4 years ago

You have a problem linking the library

CHaNGeTe commented 4 years ago

https://github.com/react-native-community/react-native-video/issues/1502

domene96 commented 4 years ago

I have linked it Captura de Pantalla 2019-09-03 a la(s) 14 41 35

CHaNGeTe commented 4 years ago

ios or android? lib version?

domene96 commented 4 years ago

package.json { "main": "node_modules/expo/AppEntry.js", "name": "Chinatown", "version": "0.1.01", "private": true, "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "expo": "^34.0.4", "firebase": "^6.5.0", "react": "16.9.0", "react-dom": "^16.9.0", "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz", "react-native-communications": "^2.2.1", "react-native-datepicker": "^1.7.2", "react-native-easy-grid": "^0.2.2", "react-native-fast-image": "^7.0.2", "react-native-fcm": "^16.2.4", "react-native-gesture-handler": "^1.3.0", "react-native-image-zoom-viewer": "^2.2.26", "react-native-lightbox": "^0.8.0", "react-native-live-stream": "^1.0.1", "react-native-media-controls": "^1.1.1", "react-native-reanimated": "^1.1.0", "react-native-video": "^5.0.0", "react-native-web": "^0.11.7", "react-navigation": "^4.0.0", "react-navigation-stack": "^1.5.1", "uuid": "^3.3.3" }, "devDependencies": { "babel-preset-expo": "^6.0.0" } }

I'm having this particular issue on android but on ios I'm having a very similar error: null is not an object (evaluating 'RNFIRMessaging.setNotifications...')

sourabhmodi20051 commented 4 years ago

This can happen if the device/simulator has an old build. Try uninstalling the app from device/simulator and install using xcode. That should resolve the issue

CHaNGeTe commented 4 years ago

RNFIRMessaging.setNotifications is not from this lib, is from Firebase AFAIK

SupriyaGo commented 4 years ago

Having the same issue, cant able to resolve. please help.

techtunix commented 4 years ago

After doing react-native link react-native-video instead of import Video from 'react-native-video'; do it, like this import Video from 'react-native'; Then, either you got it fixed or jump into next level of 'Games of Bugs' of RN!

SupriyaGo commented 4 years ago

still not working Screenshot_1575615422

TomWrd commented 4 years ago

I stumbled across a solution after struggling with this - none of the suggestions I had run into were working, including running react-native link, restarting the simulator or using the expo video component. Finally I came across:

https://docs.expo.io/versions/v36.0.0/sdk/video/

If all suggested methods are failing for react-native-video, I suggest working with expo-av.

run npm install --save expo-av


import { Video } from 'expo-av';
export default class YourClass extends Component {
    render() {
        return (
            <View>
                <Video
                source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
                rate={1.0}
                volume={1.0}
                isMuted={false}
                resizeMode="cover"
                shouldPlay
                isLooping
                style={{ width: 300, height: 300 }}
                /> 
           </View>
        );
    }
}
yongqicloud commented 4 years ago

hi,Have you solved this problem?

hamoody-omar commented 4 years ago

@domene96 I am having the same issue, were you able to solve this problem?

IronYR commented 3 years ago

@domene96 same issue. Were you able to solve it?

amitbravo commented 3 years ago

I stumbled across a solution after struggling with this - none of the suggestions I had run into were working, including running react-native link, restarting the simulator or using the expo video component. Finally I came across:

https://docs.expo.io/versions/v36.0.0/sdk/video/

If all suggested methods are failing for react-native-video, I suggest working with expo-av.

run npm install --save expo-av

import { Video } from 'expo-av';
export default class YourClass extends Component {
    render() {
        return (
            <View>
                <Video
                source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
                rate={1.0}
                volume={1.0}
                isMuted={false}
                resizeMode="cover"
                shouldPlay
                isLooping
                style={{ width: 300, height: 300 }}
                /> 
           </View>
        );
    }
}

is this going to work well with vanila react native project ?

FurkanSelvi commented 2 years ago

I'm not using expo, I'm getting the same error is there any solution?, its work IOS but android doesn't work.

SalikSayyed commented 2 years ago

I am using Expo still getting this error? but this looks closed is it resolved?

sureshiosdevhm commented 2 years ago

Why this issue is closed? Still getting the error.

Jisoonoo commented 2 years ago

so after 2 hours of debugging doing some random things..... I found a solution. This project uses some kind of old Git and gradle can't get it without jcenter().

Anyways, add jcenter() in allProjects to your build.gradle (not APP build.gradle) and npx react-native run-android (rebuild)

image

cryptic-dev commented 2 years ago

same issue

navidabasi commented 2 years ago

This actually worked for me and change the error to: [Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

ShravanMeena commented 2 years ago

so after 2 hours of debugging doing some random things..... I found a solution. This project uses some kind of old Git and gradle can't get it without jcenter().

Anyways, add jcenter() in allProjects to your build.gradle (not APP build.gradle) and npx react-native run-android (rebuild)

image

work for me

specter1997 commented 2 years ago

still not working Screenshot_1575615422 do you get the solution??

YASH6004 commented 2 years ago

so after 2 hours of debugging doing some random things..... I found a solution. This project uses some kind of old Git and gradle can't get it without jcenter(). Anyways, add jcenter() in allProjects to your build.gradle (not APP build.gradle) and npx react-native run-android (rebuild) image

work for me

It worked

specter1997 commented 2 years ago

Yes

On Fri, 8 Apr 2022, 17:45 YASH6004, @.***> wrote:

so after 2 hours of debugging doing some random things..... I found a solution. This project uses some kind of old Git and gradle can't get it without jcenter(). Anyways, add jcenter() in allProjects to your build.gradle (not APP build.gradle) and npx react-native run-android (rebuild) [image: image] https://user-images.githubusercontent.com/45225030/143676752-f50b4cd1-a436-44ed-8bc6-852fd0dd401d.png

work for me

It worked

— Reply to this email directly, view it on GitHub https://github.com/react-native-video/react-native-video/issues/1738#issuecomment-1092798167, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV6OTOM5MHQ4CDZSW2WYBTTVEAPN5ANCNFSM4ITG4F2Q . You are receiving this because you commented.Message ID: @.***>

azeezWebsultanate commented 2 years ago
Screenshot 2022-05-31 at 7 11 30 PM

Still getting the same error. I have tried everything. Uninstalling from Xcode and then re-install not working for me. The pod installs not working. Linked manually not working.

DillonMercz commented 2 years ago

I stumbled across a solution after struggling with this - none of the suggestions I had run into were working, including running react-native link, restarting the simulator or using the expo video component. Finally I came across:

https://docs.expo.io/versions/v36.0.0/sdk/video/

If all suggested methods are failing for react-native-video, I suggest working with expo-av.

run npm install --save expo-av

import { Video } from 'expo-av';
export default class YourClass extends Component {
    render() {
        return (
            <View>
                <Video
                source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
                rate={1.0}
                volume={1.0}
                isMuted={false}
                resizeMode="cover"
                shouldPlay
                isLooping
                style={{ width: 300, height: 300 }}
                /> 
           </View>
        );
    }
}

LifeSaver!!!! This solution works very well when no other solution worked. 1 million thanks!