Skip to content

Commit

Permalink
refactor: use output stream ID for ID getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryce Tham committed Oct 2, 2023
1 parent 41d6c9a commit 45bff4a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@types/mocha": "^9.0.0",
"@types/node": "^16.0.1",
"@types/sdp-transform": "^2.4.5",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"chai": "^4.3.4",
Expand Down Expand Up @@ -112,7 +111,6 @@
"events": "^3.3.0",
"js-logger": "^1.6.1",
"typed-emitter": "^2.1.0",
"uuid": "^8.3.2",
"webrtc-adapter": "^8.1.2"
},
"lint-staged": {
Expand Down
12 changes: 9 additions & 3 deletions src/media/stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AddEvents, TypedEvent, WithEventsDummyType } from '@webex/ts-events';
import { v4 as uuid } from 'uuid';

export enum StreamEventNames {
MuteStateChange = 'mute-state-change',
Expand All @@ -15,8 +14,6 @@ interface StreamEvents {
* Base stream class.
*/
abstract class _Stream {
readonly id = uuid();

// The output stream should never be reassigned, since it is the stream that is being given out.
readonly outputStream: MediaStream;

Expand Down Expand Up @@ -82,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
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2533,11 +2533,6 @@
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==

"@types/uuid@^8.3.4":
version "8.3.4"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==

"@types/which@^1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.2.tgz#9c246fc0c93ded311c8512df2891fb41f6227fdf"
Expand Down Expand Up @@ -11238,7 +11233,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==

uuid@^8.0.0, uuid@^8.3.2:
uuid@^8.0.0:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
Expand Down

0 comments on commit 45bff4a

Please sign in to comment.