https://onoumenon.gitbook.io/wiki/programming/tips/rtmp
buildPlayer() {
if (this.player || !this.props.stream) {
return;
}
const { id } = this.props.match.params;
this.player = flv.createPlayer({
type: "flv",
url: `http://localhost:8000/live/${id}.flv`
});
this.player.attachMediaElement(this.videoRef.current);
this.player.load();
}
I am trying to use this code to stream videos to users, but I get an error, if there are no stream and the app crashes.
Unhandled Rejection (AbortError): The fetching process for the media resource was aborted by the user agent at the user's request.
The error is thrown when I try to execute this:
player.attachMediaElement(videoRef.current);
Is there a way to check if this line is going to throw an error?