Fixed the sensitivity activity detector
This commit is contained in:
parent
3c02b7c6cd
commit
c6b0a7d731
2 changed files with 7 additions and 2 deletions
|
@ -187,6 +187,8 @@
|
|||
width: 100%;
|
||||
background: transparent;
|
||||
|
||||
z-index: 10;
|
||||
|
||||
.filler {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ const ActivityBar = (props: { events: Registry<MicrophoneSettingsEvents>, device
|
|||
const refHider = useRef<HTMLDivElement>();
|
||||
const [status, setStatus] = useState<ActivityBarStatus>({mode: "loading"});
|
||||
|
||||
if(typeof props.deviceId === "undefined") { throw "invalid device id"; }
|
||||
|
||||
props.events.reactUse("notify_device_level", event => {
|
||||
if (event.status === "uninitialized") {
|
||||
if (status.mode === "uninitialized")
|
||||
|
@ -62,8 +64,9 @@ const ActivityBar = (props: { events: Registry<MicrophoneSettingsEvents>, device
|
|||
} else {
|
||||
const device = event.level[props.deviceId];
|
||||
if (!device) {
|
||||
if (status.mode === "loading")
|
||||
if (status.mode === "loading") {
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus({mode: "loading"});
|
||||
} else if (device.status === "success") {
|
||||
|
@ -503,7 +506,7 @@ const ThresholdSelector = (props: { events: Registry<MicrophoneSettingsEvents> }
|
|||
return (
|
||||
<div className={cssStyle.containerSensitivity}>
|
||||
<div className={cssStyle.containerBar}>
|
||||
<ActivityBar events={props.events} deviceId={currentDevice} disabled={!isActive || !currentDevice}/>
|
||||
<ActivityBar events={props.events} deviceId={currentDevice || "none"} disabled={!isActive || !currentDevice} key={"activity-" + currentDevice} />
|
||||
</div>
|
||||
<Slider
|
||||
ref={refSlider}
|
||||
|
|
Loading…
Add table
Reference in a new issue