Cannot revert the colorTemperature applied on tracks using applyConstraints.

11 views
Skip to first unread message

hao li

unread,
Sep 10, 2021, 3:53:10 AMSep 10
to discuss-webrtc
## Description

Currently, I'm working on the implementation of colorTemperature of a project, after the implementation I want to revoke the colorTemperature that I applied on it.

## Steps to reproduce

I'm able to change the colorTemperature, initially the colorTemperature is 0 and whiteBalanceMode is 'continuous'. However, after I change the colorTemperature to any allowed value, the whiteBalanceMode is auto changed to 'manual'. I cannot reset the colorTemperature to 0 again because the value is not allowed, neither can I reset the whiteBalanceMode to 'continuous' again with the similar code that I change colorTemperature.

Code:

```
'use strict';

const video = document.querySelector('video');
const canvas = window.canvas = document.querySelector('canvas');
canvas.width = 480;
canvas.height = 360;

const constraints = {
  audio: false,
  video: true,
};

var currTracks = null;

function handleSuccess(stream) {
  const videoTracks = stream.getVideoTracks();
  currTracks = videoTracks;
  window.stream = stream; // make stream available to browser console
  video.srcObject = stream;
}

function handleError(error) {
  console.log('navigator.MediaDevices.getUserMedia error: ', error.message, error.name);
}

async function init(){
  await navigator.mediaDevices.getUserMedia(constraints).then(handleSuccess).catch(handleError);
  await changeEnv(currTracks,3600);
  setTimeout(function(){changeEnv(currTracks,5500)},1000);
}

async function changeEnv(tracks,compen) {

  console.log(tracks,performance.now());
  for (const track of tracks) {
    console.log('curr',track.getSettings());
    console.log('capab',track.getCapabilities());
    if (compen === 3600) {
      await track.applyConstraints({advanced:[{colorTemperature: compen}]});
    } else {
      await track.applyConstraints({advanced:[{whiteBalanceMode: 'continuous'}]});
    }
    console.log('curr',track.getSettings());
  } 
}
init();
```

## Expected results

The white balance mode is reset to continuous.

## Actual results

The white balance mode is still manual.


Reply all
Reply to author
Forward
0 new messages