From a3cc9f8fb1bf45741b08ce6d383c4d7cc8ea8b1f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 16 Sep 2022 20:46:58 +0200 Subject: optional streams (2, basic functionality) --- client-web/source/track_handle.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client-web/source/track_handle.ts') diff --git a/client-web/source/track_handle.ts b/client-web/source/track_handle.ts index 98b2b2f..1bb9265 100644 --- a/client-web/source/track_handle.ts +++ b/client-web/source/track_handle.ts @@ -1,6 +1,8 @@ /// 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 @@ -15,12 +17,14 @@ export class TrackHandle extends EventTarget { // 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.track.id } + get id() { return this.stream.id } //!! end() { this.track.stop(); this.dispatchEvent(new CustomEvent("ended")) } } -- cgit v1.2.3-70-g09d2