diff --git a/assets/index-BBXkj8id.js b/assets/index-BBXkj8id.js deleted file mode 100644 index 3d22da5..0000000 --- a/assets/index-BBXkj8id.js +++ /dev/null @@ -1 +0,0 @@ -import{r as l,j as e,a as m}from"./react-BkjPoRIh.js";import{c as L}from"./react-dom-DWN0RgAt.js";import{B as R}from"./react-router-dom-CyiGHeXB.js";import{a as p}from"./axios-Cm0UX6qg.js";import{J as C}from"./jszip-C_GpTb5M.js";import{F as S}from"./file-saver-B00IKLHc.js";import{u as U,a as w,b as g}from"./react-router-D3GXQn_V.js";import"./scheduler-CzFDRTuY.js";import"./@remix-run-Dql683DL.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const t of r)if(t.type==="childList")for(const n of t.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function o(r){const t={};return r.integrity&&(t.integrity=r.integrity),r.referrerPolicy&&(t.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?t.credentials="include":r.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function i(r){if(r.ep)return;r.ep=!0;const t=o(r);fetch(r.href,t)}})();const h=l.createContext({messages:[],addMessage:()=>{}}),I=({children:s})=>{const[o,i]=l.useState([]),r=t=>{i(n=>[...n,t])};return e.jsx(h.Provider,{value:{messages:o,addMessage:r},children:s})},f=()=>l.useContext(h),k=()=>{const[s,o]=l.useState([]),[i,r]=l.useState(!1),t=l.useRef(null),n=l.useRef(null),j=U(),{addMessage:u}=f(),b=async()=>{try{const a=await p.get("http://192.168.1.110:8080/photo.jpg",{responseType:"blob"});if(S.saveAs(a.data,"captura.jpg"),n.current){const c=URL.createObjectURL(a.data);n.current.src=c}}catch(a){console.error("Error al capturar la imagen:",a),u("Error al capturar la imagen:"+a)}};l.useEffect(()=>(i?t.current=setInterval(x,1e3):clearInterval(t.current),()=>{t.current&&clearInterval(t.current)}),[i]);const x=async()=>{try{const a=await p.get("http://192.168.1.110:8080/photo.jpg",{responseType:"blob"});if(o(c=>[...c,a.data]),n.current){const c=URL.createObjectURL(a.data);n.current.src=c}}catch(a){console.error("Error al capturar la imagen:",a)}},y=()=>{r(!0)},v=()=>{r(!1),N()},N=()=>{const a=new C;s.forEach((c,d)=>{a.file(`captured_frame_${d}.jpg`,c)}),a.generateAsync({type:"blob"}).then(c=>{const d=document.createElement("a");d.href=URL.createObjectURL(c),d.download="captured_frames.zip",d.click()})},E=()=>{j("/debug")};return e.jsxs("div",{children:[e.jsx("img",{ref:n,src:"http://192.168.1.110:8080/video",alt:"Video Stream",width:"529",height:"297",onError:a=>{u("Error al capturar la imagen:"+a)}}),e.jsx("button",{onClick:b,children:"Capturar una imagen"}),e.jsx("button",{onClick:y,children:"Comenzar capturaci\xF3n"}),e.jsx("button",{onClick:v,children:"Parar capturaci\xF3n"}),e.jsx("button",{onClick:E,children:"Debug"})]})},z=()=>{const{messages:s}=f();return e.jsx(e.Fragment,{children:e.jsx("div",{className:"debug-container",children:e.jsxs("div",{className:"debug-container-grid",children:[e.jsx("div",{className:"debug-container-grid-item-traza",children:e.jsx("ul",{children:s.map((o,i)=>o&&e.jsx("li",{children:o},i))})}),e.jsx("div",{className:"debug-container-grid-item-input-btns",children:e.jsx("div",{className:"debug-container-grid-item-input-field",children:e.jsxs("div",{className:"input-group mb-3",children:[e.jsx("div",{className:"input-group-prepend",children:e.jsx("span",{className:"input-group-text",id:"inputGroup-sizing-default",children:"UID"})}),e.jsx("input",{type:"number",name:"uid",placeholder:"UID del usuario que ha realizado test usabilidad",pattern:"^[0-9]+$",title:"Solo se permiten n\xFAmeros",className:"form-control","aria-label":"Default","aria-describedby":"inputGroup-sizing-default",required:!0})]})})})]})})})};function M(){return e.jsx(m.StrictMode,{children:e.jsx(I,{children:e.jsx(R,{basename:"/react-webcam",children:e.jsxs(w,{children:[e.jsx(g,{path:"/",element:e.jsx(k,{})}),e.jsx(g,{path:"/debug",element:e.jsx(z,{})})]})})})})}L.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(M,{})})); diff --git a/assets/index-Dr33aNxQ.js b/assets/index-Dr33aNxQ.js new file mode 100644 index 0000000..5c81015 --- /dev/null +++ b/assets/index-Dr33aNxQ.js @@ -0,0 +1 @@ +import{r as o,j as e,a as p}from"./react-BkjPoRIh.js";import{c as S}from"./react-dom-DWN0RgAt.js";import{B as I}from"./react-router-dom-CyiGHeXB.js";import{a as g}from"./axios-Cm0UX6qg.js";import{J as U}from"./jszip-C_GpTb5M.js";import{F as k}from"./file-saver-B00IKLHc.js";import{u as w,a as M,b as h}from"./react-router-D3GXQn_V.js";import"./scheduler-CzFDRTuY.js";import"./@remix-run-Dql683DL.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const t of r)if(t.type==="childList")for(const n of t.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function l(r){const t={};return r.integrity&&(t.integrity=r.integrity),r.referrerPolicy&&(t.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?t.credentials="include":r.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function i(r){if(r.ep)return;r.ep=!0;const t=l(r);fetch(r.href,t)}})();const f=o.createContext({messages:[],addMessage:()=>{}}),z=({children:s})=>{const[l,i]=o.useState([]),r=t=>{console.log("+++ Inside MessageProvider => "+t),i(n=>[...n,t])};return e.jsx(f.Provider,{value:{messages:l,addMessage:r},children:s})},j=()=>o.useContext(f),O=()=>{const[s,l]=o.useState([]),[i,r]=o.useState(!1),t=o.useRef(null),n=o.useRef(null),[u,b]=o.useState(0),x=w(),{addMessage:m}=j(),y=async()=>{try{const a=await g.get("http://192.168.1.110:8080/photo.jpg",{responseType:"blob"});if(k.saveAs(a.data,"captura.jpg"),n.current){const c=URL.createObjectURL(a.data);n.current.src=c}}catch(a){console.error("Error al capturar la imagen:",a),m("Error al capturar la imagen:"+a)}};o.useEffect(()=>(i?t.current=setInterval(v,1e3):clearInterval(t.current),()=>{t.current&&clearInterval(t.current)}),[i]);const v=async()=>{try{const a=await g.get("http://192.168.1.110:8080/photo.jpg",{responseType:"blob"});if(l(c=>[...c,a.data]),n.current){const c=URL.createObjectURL(a.data);n.current.src=c}}catch(a){console.error("Error al capturar la imagen:",a)}},N=()=>{r(!0)},C=()=>{r(!1),E()},E=()=>{const a=new U;s.forEach((c,d)=>{a.file(`captured_frame_${d}.jpg`,c)}),a.generateAsync({type:"blob"}).then(c=>{const d=document.createElement("a");d.href=URL.createObjectURL(c),d.download="captured_frames.zip",d.click()})},L=()=>{x("/debug")},R=()=>{b(u+1)};return e.jsxs("div",{children:[e.jsx("img",{ref:n,src:"http://192.168.1.110:8080/video",alt:"Video Stream",width:"529",height:"297",onError:a=>{m("Error al capturar la imagen:"+a)}},u),e.jsxs("h2",{children:["Contador: ",u]}),e.jsx("button",{onClick:y,children:"Capturar una imagen"}),e.jsx("button",{onClick:N,children:"Comenzar capturaci\xF3n"}),e.jsx("button",{onClick:C,children:"Parar capturaci\xF3n"}),e.jsx("button",{onClick:L,children:"Debug"}),e.jsx("button",{onClick:R,children:"Refresh"})]})},P=()=>{const{messages:s}=j();return e.jsx(e.Fragment,{children:e.jsx("div",{className:"debug-container",children:e.jsxs("div",{className:"debug-container-grid",children:[e.jsx("div",{className:"debug-container-grid-item-traza",children:e.jsx("ul",{children:s.map((l,i)=>l&&e.jsx("li",{children:l},i))})}),e.jsx("div",{className:"debug-container-grid-item-input-btns",children:e.jsx("div",{className:"debug-container-grid-item-input-field",children:e.jsxs("div",{className:"input-group mb-3",children:[e.jsx("div",{className:"input-group-prepend",children:e.jsx("span",{className:"input-group-text",id:"inputGroup-sizing-default",children:"UID"})}),e.jsx("input",{type:"number",name:"uid",placeholder:"UID del usuario que ha realizado test usabilidad",pattern:"^[0-9]+$",title:"Solo se permiten n\xFAmeros",className:"form-control","aria-label":"Default","aria-describedby":"inputGroup-sizing-default",required:!0})]})})})]})})})};function A(){return e.jsx(p.StrictMode,{children:e.jsx(z,{children:e.jsx(I,{basename:"/react-webcam",children:e.jsxs(M,{children:[e.jsx(h,{path:"/",element:e.jsx(O,{})}),e.jsx(h,{path:"/debug",element:e.jsx(P,{})})]})})})})}S.createRoot(document.getElementById("root")).render(e.jsx(p.StrictMode,{children:e.jsx(A,{})})); diff --git a/index.html b/index.html index 590ba18..481c607 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@