diff --git a/package.json b/package.json index c027173..2c1c097 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@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", @@ -111,6 +112,7 @@ "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": { diff --git a/src/media/local-stream.ts b/src/media/local-stream.ts index 3301ea6..d370bb7 100644 --- a/src/media/local-stream.ts +++ b/src/media/local-stream.ts @@ -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. * diff --git a/src/media/stream.ts b/src/media/stream.ts index f53b4ba..41941ee 100644 --- a/src/media/stream.ts +++ b/src/media/stream.ts @@ -1,4 +1,5 @@ import { AddEvents, TypedEvent, WithEventsDummyType } from '@webex/ts-events'; +import { v4 as uuid } from 'uuid'; export enum StreamEventNames { MuteStateChange = 'mute-state-change', @@ -14,6 +15,8 @@ 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; diff --git a/yarn.lock b/yarn.lock index 9f2a6c9..dd9a16f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2533,6 +2533,11 @@ 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" @@ -11233,7 +11238,7 @@ utils-merge@1.0.1: 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.0.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==