Skip to content

Commit

Permalink
feat: add id, readyState, and getAllEffects to stream classes (#62)
Browse files Browse the repository at this point in the history
* feat: add id and readyState to stream classes

* feat: add getAllEffects method

* refactor: use output stream ID for ID getter

---------

Co-authored-by: Bryce Tham <[email protected]>
  • Loading branch information
brycetham and Bryce Tham authored Oct 2, 2023
1 parent 787e429 commit 62deb74
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/media/local-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ abstract class _LocalStream extends Stream {
return this.inputTrack.label;
}

/**
* Get the readyState of the input track on this stream.
*
* @returns The readyState of the track.
*/
get readyState(): string {
return this.inputTrack.readyState;
}

/**
* Change the track of the output stream to a different track.
*
Expand Down Expand Up @@ -175,6 +184,15 @@ abstract class _LocalStream extends Stream {
return this.effects.find((e) => e.name === name)?.effect;
}

/**
* Get all the effects from the effects list.
*
* @returns A list of effect items, each containing the name and the effect itself.
*/
getAllEffects(): EffectItem[] {
return this.effects;
}

/**
* Cleanup the local effects.
*/
Expand Down
9 changes: 9 additions & 0 deletions src/media/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ abstract class _Stream {
track.removeEventListener('ended', this.handleTrackEnded);
}

/**
* Get the ID of the output stream.
*
* @returns The ID of the output stream.
*/
get id(): string {
return this.outputStream.id;
}

/**
* Check whether or not this stream is muted.
*
Expand Down

0 comments on commit 62deb74

Please sign in to comment.