Skip to content

Commit

Permalink
feat: add getEffects and fix disposeEffects to be async (#43)
Browse files Browse the repository at this point in the history
* feat(bnr): add getEffects and modify disposeEffects

* feat(bnr): bugfix
  • Loading branch information
lismith2-cisco authored Apr 13, 2023
1 parent 20f8d00 commit f5117f2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/media/local-track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,23 @@ export abstract class LocalTrack extends EventEmitter<TrackEvents> {
return effect;
}

/**
* Get a copy of the effects Map.
*
* @returns A copy of the effects map.
*/
getEffects(): Map<string, TrackEffect> {
return new Map(this.effects);
}

/**
* Cleanup the local microphone track.
*/
disposeEffects(): void {
async disposeEffects(): Promise<void> {
if (this.effects.size > 0) {
this.effects.forEach((effect: TrackEffect) => effect.dispose());
await Promise.all(
Array.from(this.effects.values(), (effect: TrackEffect) => effect.dispose())
);
this.effects.clear();

this.underlyingStream = this.originalStream;
Expand Down

0 comments on commit f5117f2

Please sign in to comment.