Open lpylinan opened 5 years ago
For what it's worth, I had this issue, but I didn't follow the example closely enough:
import { RtmpView } from 'react-native-rtmpview';
export default class Example extends Component {
componentDidMount() {
// *** This is the key bit!
this.player.initialize();
// *** End of key bit!
}
render() {
return (
<RtmpView
style={styles.player}
shouldMute={true}
ref={e => { this.player = e; }}
onPlaybackState={(data) => {
this.handlePlaybackState(data);
}}
onFirstVideoFrameRendered={(data) => {
this.handleFirstVideoFrameRendered(data);
}}
url="rtmp://localhost:1935/live/stream"
/>
)
}
}
Note the componentDidMount()
has a this.player.initialize()
which is absolutely crucial for initialising all the components properly (and one cannot initialise properly without the ref
bit)
Logs: I/ReactRTMPView: Lifecycle: onHostPause W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.perrystreetsoftware.RNRtmpViewManager I/ReactRTMPView: Lifecycle: onHostResume I/ReactRTMPView: Unable to play; not idle