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 6395bc0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/DeviceRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,14 +876,20 @@ module.exports = class DeviceRenderer {
* This method also calls recursively the destroy methods on the plugins if they exist.
*/
destroy() {
this.removeAllListeners();
this.disconnect();
this.peerConnectionStats?.destroy();
delete this.peerConnectionStats;
delete this.video;
delete this.wrapper;
delete this.videoWrapper;
delete this.root;
delete this.stream;
/**
* if the websocket is in connecting state,

Check failure on line 880 in src/DeviceRenderer.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected this line to be aligned with the start of the comment

Check failure on line 880 in src/DeviceRenderer.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed
* we can't destroy the instance cause object is not fully initialized

Check failure on line 881 in src/DeviceRenderer.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected this line to be aligned with the start of the comment
*/

Check failure on line 882 in src/DeviceRenderer.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected this line to be aligned with the start of the comment
if (this.webRTCWebsocket.readyState !== 0) {
this.removeAllListeners();
this.disconnect();
this.peerConnectionStats?.destroy();
delete this.peerConnectionStats;
delete this.video;
delete this.wrapper;
delete this.videoWrapper;
delete this.root;
delete this.stream;
}

Check failure on line 893 in src/DeviceRenderer.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed
}
};

0 comments on commit 6395bc0

Please sign in to comment.