polish(web): clear device lists on permission revoke; document probe-constraint omission
This commit is contained in:
@@ -139,7 +139,11 @@ export function useAudioDevices(): UseAudioDevicesResult {
|
|||||||
|
|
||||||
// Enumerate when permission grants; refresh on devicechange.
|
// Enumerate when permission grants; refresh on devicechange.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (permState !== 'granted') return;
|
if (permState !== 'granted') {
|
||||||
|
setInputs([]);
|
||||||
|
setOutputs([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
enumerate();
|
enumerate();
|
||||||
const onChange = () => { enumerate(); };
|
const onChange = () => { enumerate(); };
|
||||||
navigator.mediaDevices.addEventListener('devicechange', onChange);
|
navigator.mediaDevices.addEventListener('devicechange', onChange);
|
||||||
|
|||||||
@@ -436,6 +436,10 @@ export function useLiveKit() {
|
|||||||
let copy = 'Microphone could not be restored';
|
let copy = 'Microphone could not be restored';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Probe is intentionally constraint-free — we want to know whether the
|
||||||
|
// device is reachable, not whether full voice constraints succeed. Adding
|
||||||
|
// constraints here would create probe-vs-acquire skew (probe might fail
|
||||||
|
// for a constraint that AudioManager would have negotiated around).
|
||||||
const probe = await navigator.mediaDevices.getUserMedia({
|
const probe = await navigator.mediaDevices.getUserMedia({
|
||||||
audio: deviceId === 'default' ? true : { deviceId: { exact: deviceId } },
|
audio: deviceId === 'default' ? true : { deviceId: { exact: deviceId } },
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user