rtsp-relay icon indicating copy to clipboard operation
rtsp-relay copied to clipboard

Is there a way to know if the stream is dead?

Open raveena-copart opened this issue 2 years ago • 1 comments
trafficstars

Hello,

I am trying to understand if there is a way the library can tell if the requested stream is dead ?

raveena-copart avatar Oct 11 '23 20:10 raveena-copart

Hi, from the frontend you can use the onDisconnect callback

example:

// client side code
import { loadPlayer } from 'rtsp-relay/browser';

loadPlayer({
  url: `ws://${location.host}/stream`,
  canvas: document.getElementById('canvas'),

  // optional
  onDisconnect: () => console.log('Connection lost!'),
});

k-yle avatar Oct 12 '23 01:10 k-yle