@@ -418,5 +418,116 @@ <h2>Transferable MediaStreamTrack</h2>
418
418
In a sense, between these steps, the data holder is attached to the underlying source as if it was a track.</ p >
419
419
</ div >
420
420
</ section >
421
+ < section >
422
+ < h2 > Lightning correction</ h2 >
423
+ < section >
424
+ < h3 > {{MediaTrackSupportedConstraints}}</ h3 >
425
+ < pre class ="idl "
426
+ > partial dictionary MediaTrackSupportedConstraints {
427
+ boolean lightningCorrection = true;
428
+ };</ pre >
429
+ < section class ="notoc ">
430
+ < h4 > Dictionary {{MediaTrackSupportedConstraints}} Members</ h4 >
431
+ < dl class ="dictionary-members " data-dfn-for ="MediaTrackSupportedConstraints " data-link-for ="MediaTrackSupportedConstraints ">
432
+ < dt > < dfn > < code > lightningCorrection</ code > </ dfn > of type < span class ="idlMemberType "> {{boolean}}</ span > , defaulting to < code > true</ code > </ dt >
433
+ < dd >
434
+ < p > Whether < a > Lightning correction</ a > constraining is
435
+ recognized.</ p >
436
+ </ dd >
437
+ </ dl >
438
+ </ section >
439
+ </ section >
440
+ < section >
441
+ < h3 > {{MediaTrackCapabilities}}</ h3 >
442
+ < pre class ="idl "
443
+ > partial dictionary MediaTrackCapabilities {
444
+ sequence<boolean> lightningCorrection;
445
+ };</ pre >
446
+ < section class ="notoc ">
447
+ < h4 > Dictionary {{MediaTrackCapabilities}} Members</ h4 >
448
+ < dl class ="dictionary-members " data-dfn-for ="MediaTrackCapabilities " data-link-for ="MediaTrackCapabilities ">
449
+ < dt > < dfn > < code > lightningCorrection</ code > </ dfn > of type < span class ="idlMemberType "> sequence<{{boolean}}></ span > </ dt >
450
+ < dd >
451
+ < p > A sequence of supported < a > lightning correction</ a > modes.
452
+ If the source cannot do lightning correction,
453
+ a single < code > false</ code > is reported.
454
+ If the lightning correction cannot be turned off,
455
+ a single < code > true</ code > is reported.
456
+ If the script can control the lightning correction,
457
+ both < code > false</ code > and < code > true</ code > are reported as
458
+ possible values.</ p >
459
+ </ dd >
460
+ </ dl >
461
+ </ section >
462
+ </ section >
463
+ < section >
464
+ < h3 > {{MediaTrackConstraintSet}}</ h3 >
465
+ < pre class ="idl "
466
+ > partial dictionary MediaTrackConstraintSet {
467
+ ConstrainBoolean lightningCorrection;
468
+ };</ pre >
469
+ < section class ="notoc ">
470
+ < h4 > Dictionary {{MediaTrackConstraintSet}} Members</ h4 >
471
+ < dl class ="dictionary-members " data-dfn-for ="MediaTrackConstraintSet " data-link-for ="MediaTrackConstraintSet ">
472
+ < dt > < dfn > < code > lightningCorrection</ code > </ dfn > of type < span class ="idlMemberType "> {{ConstrainBoolean}}</ span > </ dt >
473
+ < dd >
474
+ < p > See < a > lightning correction</ a > constrainable property.</ p >
475
+ </ dd >
476
+ </ dl >
477
+ </ section >
478
+ </ section >
479
+ < section >
480
+ < h3 > {{MediaTrackSettings}}</ h3 >
481
+ < pre class ="idl "
482
+ > partial dictionary MediaTrackSettings {
483
+ boolean lightningCorrection;
484
+ };</ pre >
485
+ < section class ="notoc ">
486
+ < h4 > Dictionary {{MediaTrackSettings}} Members</ h4 >
487
+ < dl class ="dictionary-members " data-dfn-for ="MediaTrackSettings " data-link-for ="MediaTrackSettings ">
488
+ < dt > < dfn > < code > lightningCorrection</ code > </ dfn > of type < span class ="idlMemberType "> {{boolean}}</ span > </ dt >
489
+ < dd >
490
+ < p > Current < a > lightning correction</ a > setting.</ p >
491
+ </ dd >
492
+ </ dl >
493
+ </ section >
494
+ </ section >
495
+ < section >
496
+ < h3 > Constrainable Properties</ h3 >
497
+ < ol >
498
+ < li >
499
+ < p > < dfn > Lightning correction</ dfn > is a boolean setting
500
+ controlling whether face and background lightning balance is
501
+ to be corrected.</ p >
502
+ </ li >
503
+ </ ol >
504
+ </ section >
505
+ < section >
506
+ < h3 > Examples</ h3 >
507
+ < pre class ="example ">
508
+ <video></video>
509
+ <script>
510
+ // Open camera.
511
+ const stream = await navigator.mediaDevices.getUserMedia({video: true});
512
+ const [videoTrack] = stream.getVideoTracks();
513
+
514
+ // Try to correct lightning.
515
+ const videoCapabilities = videoTrack.getCapabilities();
516
+ if ((videoCapabilities.lightningCorrection || []).includes(true)) {
517
+ await videoTrack.applyConstraints({
518
+ advanced: [{lightningCorrection: true}]
519
+ });
520
+ } else {
521
+ // Lightning correction is not supported by the platform or by the camera.
522
+ // Consider falling back to some other method.
523
+ }
524
+
525
+ // Show to user.
526
+ const videoElement = document.querySelector("video");
527
+ videoElement.srcObject = stream;
528
+ </script>
529
+ </ pre >
530
+ </ section >
531
+ </ section >
421
532
</ body >
422
533
</ html >
0 commit comments