Skip to content

Commit

Permalink
fix: clean up mediastream plugins (#3287)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 authored Oct 8, 2024
1 parent 2b88485 commit 75e9ead
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
*/
async cleanup() {
this.removeTrackEventListeners(this.nativeTrack);
// Stopping the plugin before cleaning the track is more predictable when dealing with 3rd party plugins
await this.mediaStreamPluginsManager.cleanup();
await this.pluginsManager.cleanup();
super.cleanup();
this.transceiver = undefined;
await this.pluginsManager.cleanup();
this.processedTrack?.stop();
this.isPublished = false;
if (isBrowser && isMobile()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ export class HMSMediaStreamPluginsManager {
getPlugins(): string[] {
return Array.from(this.plugins).map(plugin => plugin.getName());
}

async cleanup() {
this.removePlugins(Array.from(this.plugins));
}
}

0 comments on commit 75e9ead

Please sign in to comment.