react-native-video: Cannot read property 'Constants' of undefined

I know this is a duplicate issue, but none of the other solutions have worked for me.

screen shot 2017-05-02 at 11 00 47 am
...
"react": "15.3.1",
"react-native": "^0.35.0",
"react-native-video": "^1.0.0",
...

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 18 (6 by maintainers)

Most upvoted comments

@johnchourajr Nevermind, run react-native run-ios to reinstall the application after linking with react-native link.

ios 1、先按照这个组件的说明,修改APPDelegate.m。如果还不行。 2、打开xcode。查看Libraries里面有没有RCTVideo.xcodeproj.。如果没有,添加它。这个文件在你的项目node_modules/react-native-video文件夹中 3、build Phases----Link Binary with Libraries中添加libRCTVideo.a 4、编译运行。

我的问题就是这样解决的

Leave all and Simply Go Native and Do it Like this!

1). expo install expo-av

2). Your App.js should be

import React from ‘react’; import { StyleSheet, Text, View } from ‘react-native’;

import { Video } from ‘expo-av’;

export default class App extends React.Component { render(){ return ( <View style={styles.container}> <Text>Open up App.js to start working on your app!</Text>

    <Video
    source={{ uri: 'https://www.yourdomain.com/uploads/video_file.mp4' }}
    shouldPlay
    useNativeControls 
    style={{ width: "100%", height: "50%" }}
  />

  </View>
);

} }

const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: ‘#fff’, alignItems: ‘center’, justifyContent: ‘center’, }, });

3). expo start

When using CocoaPods, one might have to link it manually in the podfile:

pod 'react-native-video', :path => File.join(node_modules_path, 'react-native-video/react-native-video.podspec')