From 4a8af83c8fdc5fbf46686e030101bc0d111f6bc9 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Wed, 20 Apr 2022 10:57:42 +0200 Subject: [PATCH] WIP --- src/platform/types/MediaDevices.ts | 19 +++++++++---------- src/platform/web/dom/MediaDevices.ts | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/platform/types/MediaDevices.ts b/src/platform/types/MediaDevices.ts index 85f64f95..93418a66 100644 --- a/src/platform/types/MediaDevices.ts +++ b/src/platform/types/MediaDevices.ts @@ -20,11 +20,14 @@ export interface MediaDevices { // to assign to a video element, we downcast to WrappedTrack and use the stream property. getMediaTracks(audio: true | MediaDeviceInfo, video: boolean | MediaDeviceInfo): Promise; getScreenShareTrack(): Promise; + createVolumeMeasurer(stream: Stream): VolumeMeasurer; } + export interface Stream { - readonly audioTrack: AudioTrack | undefined; - readonly videoTrack: Track | undefined; + getTracks(): ReadonlyArray; + getAudioTracks(): ReadonlyArray; + getVideoTracks(): ReadonlyArray; readonly id: string; clone(): Stream; } @@ -38,15 +41,11 @@ export interface Track { readonly kind: TrackKind; readonly label: string; readonly id: string; - readonly settings: MediaTrackSettings; - get enabled(): boolean; - set enabled(value: boolean); - equals(track: Track): boolean; + enabled: boolean; + // getSettings(): MediaTrackSettings; stop(): void; } -export interface AudioTrack extends Track { - // TODO: how to emit updates on this? - get isSpeaking(): boolean; +export interface VolumeMeasurer { + } - diff --git a/src/platform/web/dom/MediaDevices.ts b/src/platform/web/dom/MediaDevices.ts index a04fca91..4eb92259 100644 --- a/src/platform/web/dom/MediaDevices.ts +++ b/src/platform/web/dom/MediaDevices.ts @@ -98,6 +98,7 @@ export class StreamWrapper implements Stream { } update(track: MediaStreamTrack): TrackWrapper | undefined { + //console.trace("Stream.update " + JSON.stringify({id: track.id, vid: this.videoTrack?.id, aid: this.audioTrack?.id})); if (track.kind === "video") { if (!this.videoTrack || track.id !== this.videoTrack.track.id) { this.videoTrack = new TrackWrapper(track, this.stream, track.id);