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