Skip to content

Commit

Permalink
fix issue chen destroy a not fully initialized player
Browse files Browse the repository at this point in the history
  • Loading branch information
jparez committed Mar 20, 2024
1 parent 9fb1638 commit abecc80
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/DeviceRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,14 @@ module.exports = class DeviceRenderer {
* This method also calls recursively the destroy methods on the plugins if they exist.
*/
destroy() {
/**
* if the websocket is in connecting state,
* we can't destroy the instance cause object is not fully initialized
*/
if (this.webRTCWebsocket.readyState === 0) {
return;
}

this.removeAllListeners();
this.disconnect();
this.peerConnectionStats?.destroy();
Expand Down

0 comments on commit abecc80

Please sign in to comment.