Answer the question
In order to leave comments, you need to log in
Why was RCTNodePlayer not found?
I am using react-native-nodemediaclient but got an error and went into the module itself. There is
import React, { Component } from 'react';
import { PropTypes } from 'prop-types';
import { requireNativeComponent, View, UIManager, findNodeHandle } from 'react-native';
var RCT_VIDEO_REF = 'NodePlayerView';
class NodePlayerView extends Component {
constructor(props) {
super(props);
}
_onChange(event) {
if (!this.props.onStatus) {
return;
}
this.props.onStatus(event.nativeEvent.code, event.nativeEvent.message);
}
pause() {
UIManager.dispatchViewManagerCommand(
findNodeHandle(this.refs[RCT_VIDEO_REF]),
UIManager.RCTNodePlayer.Commands.pause,
null
);
}
start() {
UIManager.dispatchViewManagerCommand(
findNodeHandle(this.refs[RCT_VIDEO_REF]),
UIManager.RCTNodePlayer.Commands.start,
null
);
}
stop() {
UIManager.dispatchViewManagerCommand(
findNodeHandle(this.refs[RCT_VIDEO_REF]),
UIManager.RCTNodePlayer.Commands.stop,
null
);
}
render() {
return <RCTNodePlayer
{...this.props}
ref={RCT_VIDEO_REF}
onChange={this._onChange.bind(this)}
/>;
};
}
NodePlayerView.name = RCT_VIDEO_REF;
NodePlayerView.propTypes = {
inputUrl: PropTypes.string,
bufferTime: PropTypes.number,
maxBufferTime: PropTypes.number,
autoplay: PropTypes.bool,
scaleMode: PropTypes.oneOf(['ScaleToFill', 'ScaleAspectFit', 'ScaleAspectFill']),
renderType: PropTypes.oneOf(['SURFACEVIEW', 'TEXTUREVIEW']),
onStatus: PropTypes.func,
...View.propTypes // 包含默认的View的属性
};
const RCTNodePlayer = requireNativeComponent('RCTNodePlayer', NodePlayerView, {
nativeOnly: { onChange: true }
});
module.exports = NodePlayerView;
Answer the question
In order to leave comments, you need to log in
I didn’t use this particular library, it seems I saw similar errors when the native part of the library was not linked.
Read carefully the instructions for installing this library:
- check the react-native link
- check the gradle files if you are building for android
- check the pods if you are building for ios
- rebuild the build cleanly
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question