-
Notifications
You must be signed in to change notification settings - Fork 344
React liveness/provide default device info #6633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
React liveness/provide default device info #6633
Conversation
…ice automatically
🦋 Changeset detectedLatest commit: 13ac976 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hello @riasatali42 , thanks for creating the PR! There's conflicts in the branch. Could you resolve the conflict and resubmit the PR? |
…aNotFoundCallback and device change callback methods after resolving merge conflicts
Hello @Simone319 , I have updated the branch with the current main branch and resolved all the conflicts. I've updated this PR instead of creating a new branch. Please let me know if I should do otherwise. |
Hi @riasatali42, |
…ide-default-device-info
Hello @soberm , |
Hi @riasatali42, |
…ss default device pass in
Hello @soberm , I've updated the PR. Please let me know if we need anything else. |
Hey @riasatali42, I can't execute the E2E tests due to a missing step implementation.
|
…ide-default-device-info
… case for device info pass out
Hello @soberm , I've added the step. Please take a look now. |
Hello @soberm - circling back on this. We are eager to get this merged. Could the team please review and return any issues to us so we can bring this to a close? |
…ide-default-device-info
We're currently reviewing this internally with our team and update you here once we have more information. |
Hi @riasatali42, @jasonfill, thank you for your work on implementing this feature for the Requested Changes
Your PR includes both We suggest removing the export interface FaceLivenessDetectorCoreConfig {
deviceId?: string; // Only this parameter should be supported
// ... other existing config options
}
We suggest removing the callbacks that were added:
The existing
We suggest using the existing callbacks to include optional DeviceInfo parameter to pass this information: export interface DeviceInfo {
deviceId: string;
groupId: string;
label: string;
}
export interface FaceLivenessDetectorCoreProps {
onAnalysisComplete: (deviceInfo?: DeviceInfo) => Promise<void>;
onError?: (livenessError: LivenessError, deviceInfo?: DeviceInfo) => void;
}
Ensure Thank you again for taking the initiative to implement this feature and for your patience as we work through the design. |
@soberm I have a few items on these
Numbers 3 and 4 make sense, and we can incorporate them. Please provide the final direction on 1 & 2, and we will look to wrap this up. cc @riasatali42 |
@jasonfill thank you for the feedback. Here are our thoughts on this: 1. Device Input Parameters 2. Callback Methods What are your thoughts on this approach? |
@soberm since the deviceId is not reliable, it makes no sense for us to use that. Our goal is to preload the camera that was used last. The only level of reliability is to do that via label. If label is. Or permitted, this feature is rendered useless for us. Unless I am missing the concept of what you are outlining. On point 2, that makes total sense. We can adjust to use the onError. |
@jasonfill Yes, the deviceId might change but if you already store the deviceLabel of the last used device it should be possible to get the DeviceInfo for the device with this label and then pass the deviceId to the liveness component. Maybe like this: // Get device by label and extract deviceId
async function getDeviceIdByLabel(targetLabel) {
const devices = await navigator.mediaDevices.enumerateDevices();
const camera = devices.find(device =>
device.kind === 'videoinput' && device.label === targetLabel
);
return camera?.deviceId;
}
const lastUsedLabel = getStoredCameraLabel(); // your stored device
const deviceId = await getDeviceIdByLabel(lastUsedLabel);
if (deviceId) {
// Pass to liveness component
<LivenessComponent deviceId={deviceId} />
} Would this approach work for your use case ? |
@soberm We can make that work. The team will roll these changes in ASAP. Thanks for your time and collaboration. |
…ide-default-device-info
… callback from types
…onCameraNotFound callback
…camera is availabel with the deviceId
Hello @soberm , I've updated the code according to your feedback. Please let me know if there's anything else. |
Also, @soberm , please let me know if I should add a new changeset or update the old one with the changes. |
Description of changes
This PR introduces features to pass in and out the device information (device Id, device label, kind, group Id) for the camera of the liveness check. Also, provides support to add callback methods for camera changes or default device not found.
Key additions:
Issue ##6587, Pass deviceId in and out of liveness check
Description of how you validated changes
Checklist
yarn test
passes and tests are updated/addeddocs
,e2e
,examples
, or other private packages.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.