k-yle / rtsp-relay

📽 View an RTSP stream in your web browser using an express.js server
https://npm.im/rtsp-relay
MIT License
312 stars 58 forks source link

Show Message When RTSP is Disconnected or Not Connected #266

Open alfian444 opened 2 months ago

alfian444 commented 2 months ago

How can I display an error message when the RTSP connection cannot be connected or is disconnected, and remove the error message if the connection is successful reconnects and continues streaming

I tried to create code to display an error message like this:

    loadPlayer({
      url: 'ws://' + location.host + '/api/stream',
      canvas: document.getElementById('canvas'),
      onDisconnect: () => {
             $('#error').text('Streaming disconnect');
             $('#error').show();
      }
    });

but I can't remove the #error when rtsp reconnect, because there is no function to know whether the stream reconnected successfully or not