【问题标题】:How to Display Video with React native如何使用 React Native 显示视频
【发布时间】:2021-08-07 18:04:50
【问题描述】:

我试图在 react 本机应用程序上显示视频,但是当我运行应用程序时出现错误 TypeError: undefined is not an object (evalating 'RCTVideoInstance.Constants')

我运行了这些命令,但它不起作用: npm install react-native-video react-native 链接 react-native-video

这是我的代码:

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>
        )
    }
}

【问题讨论】:

    标签: react-native video react-native-video


    【解决方案1】:

    尝试使用 expo-av 而不是 react-native-video

    更多信息:https://github.com/react-native-video/react-native-video/issues/1738#issuecomment-575243702

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多