k-yle / rtsp-relay

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

Access source property for Player #232

Open Caggegi opened 11 months ago

Caggegi commented 11 months ago

Hello, there is any way to access source property and set shouldAttemptReconnect to false from the frontend? I have to manage multiple streams and the server could be down for some streams sometimes so I have to stop the reconnect attempts. Currently the change of the stream and the creation of a new Player is not possible due to the reconnection attempts of the stream selected before.

to reproduce that issue just make a page with a text input and a canvas, put in the text input the right ws and let the player start. Then change to a new fake ws, so the player cannot connect. At the end change back the url to a working ws, the player is not working anymore due to the previous fake connection. Screenshot from 2023-10-25 18-00-42

alfian444 commented 11 months ago

maybe this can help

players[id]=loadPlayer({ url:url canvas: canvas disconnectThreshold:30000, onDisconnect: () => { players[id].then(function(result) { result.destroy() }); });

Caggegi commented 11 months ago

I tried but that does not solve the problem, the connection attempts are like a loop that don't let the player call onDisconnect.