Glainez commited on
Commit
e4febf0
·
verified ·
1 Parent(s): 7e03464

Create select_back_camera.js

Browse files
Files changed (1) hide show
  1. select_back_camera.js +18 -0
select_back_camera.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.addEventListener('load', (event) => {
2
+ // Wait for Gradio interface to fully load
3
+ const gradioAppLoaded = setInterval(() => {
4
+ const webcamButton = document.querySelector('button[aria-label="select input source"]');
5
+ if (webcamButton) {
6
+ clearInterval(gradioAppLoaded);
7
+ webcamButton.click();
8
+ setTimeout(() => {
9
+ const backCameraOption = Array.from(document.querySelectorAll('select option')).find(option => option.text.toLowerCase().includes('back'));
10
+ if (backCameraOption) {
11
+ backCameraOption.selected = true;
12
+ const event = new Event('change', { bubbles: true });
13
+ backCameraOption.parentElement.dispatchEvent(event);
14
+ }
15
+ }, 500); // Adjust timeout as necessary to ensure dropdown is populated
16
+ }
17
+ }, 1000);
18
+ });