@@ -551,6 +551,72 @@ <h2>Exposing MediaStreamTrack source background blur support</h2>
551
551
};</ pre >
552
552
</ div >
553
553
</ section >
554
+ < section >
555
+ < h2 > Exposing MediaStreamTrack source lighting correction support</ h2 >
556
+ < p > Some platforms or User Agents may provide built-in support for human
557
+ face lighting correction, in particular for camera video streams.
558
+ Web applications may either want to control or at least be aware that
559
+ human face lighting correction is applied at the source level.
560
+ This may for instance allow the web application to update its UI or to
561
+ not apply human face lighting correction on its own.
562
+ For that reason, we extend {{MediaStreamTrack}} with the following
563
+ properties.
564
+ </ p >
565
+ < p > The WebIDL changes are the following:</ p >
566
+ < pre class ="idl "
567
+ > partial dictionary MediaTrackSupportedConstraints {
568
+ boolean lightingCorrection = true;
569
+ };
570
+
571
+ partial dictionary MediaTrackCapabilities {
572
+ sequence<boolean> lightingCorrection;
573
+ };
574
+
575
+ partial dictionary MediaTrackConstraintSet {
576
+ ConstrainBoolean lightingCorrection;
577
+ };
578
+
579
+ partial dictionary MediaTrackSettings {
580
+ boolean lightingCorrection;
581
+ };</ pre >
582
+ < section >
583
+ < h3 > Processing considerations</ h3 >
584
+ < p > When the "lightingCorrection" setting is set to < code > true</ code > by
585
+ the < a > ApplyConstraints algorithm</ a > , the UA will attempt to correct
586
+ human face and background lighting balance.
587
+ </ p >
588
+ < p > When the "lightingCorrection" setting is set to < code > false</ code > by
589
+ the < a > ApplyConstraints algorithm</ a > , the UA will not correct human
590
+ face and background lighting balance.
591
+ </ p >
592
+ </ section >
593
+ < section >
594
+ < h3 > Examples</ h3 >
595
+ < pre class ="example ">
596
+ <video></video>
597
+ <script>
598
+ // Open camera.
599
+ const stream = await navigator.mediaDevices.getUserMedia({video: true});
600
+ const [videoTrack] = stream.getVideoTracks();
601
+
602
+ // Try to correct lighting.
603
+ const videoCapabilities = videoTrack.getCapabilities();
604
+ if ((videoCapabilities.lightingCorrection || []).includes(true)) {
605
+ await videoTrack.applyConstraints({
606
+ advanced: [{lightingCorrection: true}]
607
+ });
608
+ } else {
609
+ // Lighting correction is not supported by the platform or by the camera.
610
+ // Consider falling back to some other method.
611
+ }
612
+
613
+ // Show to user.
614
+ const videoElement = document.querySelector("video");
615
+ videoElement.srcObject = stream;
616
+ </script>
617
+ </ pre >
618
+ </ section >
619
+ </ section >
554
620
< section >
555
621
< h2 > VoiceIsolation constraint</ h2 >
556
622
< div >
0 commit comments