refac
This commit is contained in:
1 parent
4fe2de7864
commit
5c3edc2539
1 file changed
+7
-1
@@ -63,7 +63,12 @@
|
|||||||
|
|
||||||
console.log(videoInputDevices);
|
console.log(videoInputDevices);
|
||||||
if (selectedVideoInputDeviceId === null && videoInputDevices.length > 0) {
|
if (selectedVideoInputDeviceId === null && videoInputDevices.length > 0) {
|
||||||
selectedVideoInputDeviceId = videoInputDevices[0].deviceId;
|
const savedDeviceId = localStorage.getItem('selectedVideoInputDeviceId');
|
||||||
|
if (savedDeviceId && videoInputDevices.some((d) => d.deviceId === savedDeviceId)) {
|
||||||
|
selectedVideoInputDeviceId = savedDeviceId;
|
||||||
|
} else {
|
||||||
|
selectedVideoInputDeviceId = videoInputDevices[0].deviceId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -890,6 +895,7 @@
|
|||||||
on:change={async (e) => {
|
on:change={async (e) => {
|
||||||
console.log(e.detail);
|
console.log(e.detail);
|
||||||
selectedVideoInputDeviceId = e.detail;
|
selectedVideoInputDeviceId = e.detail;
|
||||||
|
localStorage.setItem('selectedVideoInputDeviceId', e.detail);
|
||||||
await stopVideoStream();
|
await stopVideoStream();
|
||||||
await startVideoStream();
|
await startVideoStream();
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user