As per azure face liveness detection doc I create a session and got token in server side, but in a client side I’m using React JS.
i followed the link the .npmrc setup and installed the library npm install azure-ai-vision-faceanalyzer
After that I paste the token which is got from session response
when I run the project I got and white page and error like this in my console
GET http://localhost:5173/faceanalyzer-assets/js/AzureAIVisionFace_SIMDBundle.js net::ERR_ABORTED 404 (Not Found)
import React, { useRef } from 'react';
// Step 1: Import the web component.
import "azure-ai-vision-faceanalyzer";
const AzureAIVisionFaceAnalyzerComponent = () => {
const containerRef = useRef(null);
// Step 2: Create the faceanalyzer element, set the token and upgrade the element.
let azureAIVisionFaceAnalyzer = document.createElement("azure-ai-vision-faceanalyzer");
customElements.upgrade(azureAIVisionFaceAnalyzer);
azureAIVisionFaceAnalyzer.token = "***TOKEN***";
azureAIVisionFaceAnalyzer.addEventListener('analyzed', (event) => {
// The event.result, which is FaceAnalyzedResult interface, contains the result of the analysis.
console.log(event);
});
if (containerRef.current) {
containerRef.current.appendChild(azureAIVisionFaceAnalyzer);
}
return <div ref={containerRef}></div>;
};
function App() {
return (
<div className="App">
<AzureAIVisionFaceAnalyzerComponent />
</div>
);
}
export default App;
Gangeswaran KANNAN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.