This commit is contained in:
Bruno Windels 2022-04-20 10:57:42 +02:00
parent c42292f1b0
commit 4a8af83c8f
2 changed files with 10 additions and 10 deletions

View file

@ -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<Stream>;
getScreenShareTrack(): Promise<Stream | undefined>;
createVolumeMeasurer(stream: Stream): VolumeMeasurer;
}
export interface Stream {
readonly audioTrack: AudioTrack | undefined;
readonly videoTrack: Track | undefined;
getTracks(): ReadonlyArray<Track>;
getAudioTracks(): ReadonlyArray<Track>;
getVideoTracks(): ReadonlyArray<Track>;
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 {
}

View file

@ -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);