phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.31k stars 1.43k forks source link

Issue on closing and reopening tab #341

Closed mmeyers-solartech closed 4 years ago

mmeyers-solartech commented 4 years ago

I have configured the stream to start and stop depending on if there is a viewer. So on first launch when the videoStream.js class hits onSocketConnect, that's when startMpegStream() gets run. Then, on socketClose, I stop the stream. This works well on first launch, but when I close the tab (react jsmpeg component) and reopen (the stream also restarts) the player is frozen and half of it is green. VideoStream.js perfectly recognizes those close tab events and closes the websocket, but if a new stream is created rather than a reconnection to the original the player fails, despite the new stream recognizing the new client websocket connection.

On opening and closing does the player try to reconnect to the same closed websocket? RuntimeError: index out of bounds 0.chunk.js line 1288 > WebAssembly.instantiate:3444:1