如何解决如何使用 React Native 显示视频
我正在尝试在 React Native 应用程序上显示视频,但是当我运行该应用程序时出现错误 TypeError: undefined is not an object (evaluating '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>
)
}
}
解决方法
尝试使用 expo-av 而不是 react-native-video
更多信息:https://github.com/react-native-video/react-native-video/issues/1738#issuecomment-575243702
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。