Issue with media stream constraints type in lib.dom.d.ts #22897
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Help Wanted
You can do this
TypeScript Version: ~2.5.3
Integrating screen share, invalid type for MediaStreamConstraints
Code
Expected behavior:
I get a stream URL which I can use in my video tag.
Actual behavior:
Argument of type '{ video: { mandatory: { chromeMediaSource: string; maxWidth: number; maxHeight: number; maxFrameR...' is not assignable to parameter of type 'MediaStreamConstraints'.
Types of property 'video' are incompatible.
Type '{ mandatory: { chromeMediaSource: string; maxWidth: number; maxHeight: number; maxFrameRate: numb...' is not assignable to type 'boolean | MediaTrackConstraints'.
Object literal may only specify known properties, and 'mandatory' does not exist in type 'boolean | MediaTrackConstraints'.
I checked the format for video in lib.dom.d.ts which was either a boolean value or an interface with the following format.
interface MediaTrackCapabilities { aspectRatio?: number | DoubleRange; deviceId?: string; echoCancellation?: boolean[]; facingMode?: string; frameRate?: number | DoubleRange; groupId?: string; height?: number | LongRange; sampleRate?: number | LongRange; sampleSize?: number | LongRange; volume?: number | DoubleRange; width?: number | LongRange; }
When I try to provide the sourceId in the expected format of the interface
deviceId: {exact: [sourceId]}
I end up getting back the stream of my webcam when the stream I'm expecting is that of my screenshare whose sourceId I have passed.
I can get the expected behaviour I want if the mandatory object was allowed in media stream constraints.
The text was updated successfully, but these errors were encountered: