forked from mystiq/hydrogen-web
WIP
This commit is contained in:
parent
c42292f1b0
commit
4a8af83c8f
2 changed files with 10 additions and 10 deletions
|
@ -20,11 +20,14 @@ export interface MediaDevices {
|
||||||
// to assign to a video element, we downcast to WrappedTrack and use the stream property.
|
// to assign to a video element, we downcast to WrappedTrack and use the stream property.
|
||||||
getMediaTracks(audio: true | MediaDeviceInfo, video: boolean | MediaDeviceInfo): Promise<Stream>;
|
getMediaTracks(audio: true | MediaDeviceInfo, video: boolean | MediaDeviceInfo): Promise<Stream>;
|
||||||
getScreenShareTrack(): Promise<Stream | undefined>;
|
getScreenShareTrack(): Promise<Stream | undefined>;
|
||||||
|
createVolumeMeasurer(stream: Stream): VolumeMeasurer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface Stream {
|
export interface Stream {
|
||||||
readonly audioTrack: AudioTrack | undefined;
|
getTracks(): ReadonlyArray<Track>;
|
||||||
readonly videoTrack: Track | undefined;
|
getAudioTracks(): ReadonlyArray<Track>;
|
||||||
|
getVideoTracks(): ReadonlyArray<Track>;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
clone(): Stream;
|
clone(): Stream;
|
||||||
}
|
}
|
||||||
|
@ -38,15 +41,11 @@ export interface Track {
|
||||||
readonly kind: TrackKind;
|
readonly kind: TrackKind;
|
||||||
readonly label: string;
|
readonly label: string;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly settings: MediaTrackSettings;
|
enabled: boolean;
|
||||||
get enabled(): boolean;
|
// getSettings(): MediaTrackSettings;
|
||||||
set enabled(value: boolean);
|
|
||||||
equals(track: Track): boolean;
|
|
||||||
stop(): void;
|
stop(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AudioTrack extends Track {
|
export interface VolumeMeasurer {
|
||||||
// TODO: how to emit updates on this?
|
|
||||||
get isSpeaking(): boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ export class StreamWrapper implements Stream {
|
||||||
}
|
}
|
||||||
|
|
||||||
update(track: MediaStreamTrack): TrackWrapper | undefined {
|
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 (track.kind === "video") {
|
||||||
if (!this.videoTrack || track.id !== this.videoTrack.track.id) {
|
if (!this.videoTrack || track.id !== this.videoTrack.track.id) {
|
||||||
this.videoTrack = new TrackWrapper(track, this.stream, track.id);
|
this.videoTrack = new TrackWrapper(track, this.stream, track.id);
|
||||||
|
|
Loading…
Reference in a new issue