Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clean up mediastream plugins #3287

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,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();
KaustubhKumar05 marked this conversation as resolved.
Show resolved Hide resolved
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));
}
}
Loading