Re: No way to specify remote constraints?

On 02/12/2013 2:15 PM, Martin Thomson wrote:
> On 2 December 2013 10:59, cowwoc <cowwoc@bbs.darktech.org> wrote:
>> var videoTrack = remoteMediaStream.getVideoTracks()[0];
>> var remoteConstraints = videoTrack.constraints();
>> remoteConstraints.mandatory.width = 320;
>> remoteConstraints.mandatory.height = 240;
>>
>> Will this force the remote end to downscale to 320x240 before sending the
>> video over the wire?
> That won't, because you are modifying something that the browser gave
> you to play with.  It won't change anything.
>
> Try
>
> var videoTrack = remoteMediaStream.getVideoTrac
> ks()[0].clone(); //!
> var remoteConstraints = videoTrack.constraints();
> remoteConstraints.mandatory.width = 320;
> remoteConstraints.mandatory.height = 240;
> videoTrack.applyConstraints(remoteConstraints); //!
>
> That is, assuming that mandatory is not null in the first place.

Thanks for the clarification.

 1. Why do I need to clone() the video track before modifying it?
 2. What is the relationship between a cloned VideoTrack and the
    original MediaStream? Isn't it a little weird that a MediaStream is
    associated with VideoTracks you can't navigate to from the original
    object?

Gili

Received on Monday, 2 December 2013 19:20:18 UTC