client-sdk-js icon indicating copy to clipboard operation
client-sdk-js copied to clipboard

TypeScript: `createLocal…Track` should accept type `MediaTrackConstraints`

Open Philzen opened this issue 3 years ago • 1 comments

I am using createLocalVideoTrack() and would like to supply an aspectRatio and ideal dimension, but not a fixed width/height, which the current interface unfortunately mandates.

As the options given to createLocalVideoTrack and createLocalAudioTrack are merged in constraintsForOptions() into an object containing MediaTrackConstraints as per the W3C spec anyway, wouldn't it be feasible to have the same uniform interface in the first place here?

Philzen avatar Jun 20 '22 23:06 Philzen

Hi @Philzen, you can supply aspectRatio as part of the videoResolution in the VideoCaptureOptions. The default behaviour should be ideal. What we currently don't support is matching constraints with max, min, exact.

You can however always create your own mediastreamtrack with MediaTrackConstraints and create a LiveKit LocalVideoTrack from it, by simply calling new LocalVideoTrack(mediastreamtrack)

lukasIO avatar Jun 27 '22 12:06 lukasIO

we'll keep this in mind for a major version change, until then closing as not planned

lukasIO avatar Mar 02 '23 13:03 lukasIO