diff options
Diffstat (limited to 'client-web/source/track_handle.ts')
-rw-r--r-- | client-web/source/track_handle.ts | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/client-web/source/track_handle.ts b/client-web/source/track_handle.ts deleted file mode 100644 index b680949..0000000 --- a/client-web/source/track_handle.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - This file is part of keks-meet (https://codeberg.org/metamuffin/keks-meet) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2023 metamuffin <metamuffin.org> -*/ -/// <reference lib="dom" /> - -/// We need this to adjust the way events are fired -export class TrackHandle extends EventTarget { - stream: MediaStream // this is used to create an id that is persistent across clients - - constructor( - public track: MediaStreamTrack, - public local = false - ) { - super() - track.onended = () => this.dispatchEvent(new CustomEvent("ended")) - // TODO research how onmute and onunmute behave - track.onmute = () => this.dispatchEvent(new CustomEvent("ended")) // onmute seems to be called when the remote ends the track - track.onunmute = () => this.dispatchEvent(new CustomEvent("started")) - - this.addEventListener("ended", () => { - // drop all references to help gc - track.onunmute = track.onmute = track.onended = null - }) - - this.stream = new MediaStream([track]) - } - - get kind() { return this.track.kind } - get label() { return this.track.label } - get muted() { return this.track.muted } - get id() { return this.stream.id } //!! - - end() { this.track.stop(); this.dispatchEvent(new CustomEvent("ended")) } -} |