Skip to content

Commit

Permalink
fix(liveness): use video stream dimensions instead of videoEl dimensi…
Browse files Browse the repository at this point in the history
…ons (#5798)

* fix(liveness): use video stream dimensions instead of videoEl dimensions

* Create curly-readers-reflect.md
  • Loading branch information
thaddmt authored Sep 18, 2024
1 parent 7a12237 commit 2f0119f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-readers-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aws-amplify/ui-react-liveness": patch
---

fix(liveness): use video stream dimensions instead of videoEl dimensions
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class LivenessStreamProvider {
private _reader!: ReadableStreamDefaultReader;
private videoEl: HTMLVideoElement;
private _client!: RekognitionStreamingClient;
private _stream: MediaStream;
private stream: MediaStream;
private initPromise: Promise<void>;

constructor({
Expand All @@ -74,7 +74,7 @@ export class LivenessStreamProvider {
}: StreamProviderArgs) {
this.sessionId = sessionId;
this.region = region;
this._stream = stream;
this.stream = stream;
this.videoEl = videoEl;
this.videoRecorder = new VideoRecorder(stream);
this.credentialProvider = credentialProvider;
Expand Down Expand Up @@ -198,13 +198,15 @@ export class LivenessStreamProvider {
this.videoRecorder.videoStream
)();

const mediaSettings = this.stream.getTracks()[0].getSettings();

const response = await this._client.send(
new StartFaceLivenessSessionCommand({
ChallengeVersions: 'FaceMovementAndLightChallenge_1.0.0',
SessionId: this.sessionId,
LivenessRequestStream: livenessRequestGenerator,
VideoWidth: this.videoEl.videoWidth.toString(),
VideoHeight: this.videoEl.videoHeight.toString(),
VideoWidth: (mediaSettings.width ?? this.videoEl.width).toString(),
VideoHeight: (mediaSettings.height ?? this.videoEl.height).toString(),
})
);
return response.LivenessResponseStream!;
Expand Down

0 comments on commit 2f0119f

Please sign in to comment.