Skip to content

Commit

Permalink
Merge pull request #2443 from entrylabs/issue/5732
Browse files Browse the repository at this point in the history
이슈 5732
  • Loading branch information
kimorkim authored Feb 1, 2023
2 parents 1b6ee55 + cfbee47 commit 906af70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/util/videoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import clamp from 'lodash/clamp';
type FlipStatus = {
horizontal: boolean;
vertical: boolean;
isChanged: boolean;
};

type ModelStatus = {
Expand Down Expand Up @@ -79,6 +80,7 @@ class VideoUtils implements MediaUtilsInterface {
public flipStatus: FlipStatus = {
horizontal: false,
vertical: false,
isChanged: false,
};

public indicatorStatus: ModelStatus = {
Expand Down Expand Up @@ -414,7 +416,7 @@ class VideoUtils implements MediaUtilsInterface {
}

videoOnLoadHandler() {
if (!this.flipStatus.horizontal) {
if (!this.flipStatus.horizontal && !this.flipStatus.isChanged) {
this.setOptions('hflip', null);
}
}
Expand Down Expand Up @@ -745,6 +747,7 @@ class VideoUtils implements MediaUtilsInterface {
GEHelper.setVideoAlpha(this.canvasVideo, value);
break;
case 'hflip':
this.flipStatus.isChanged = true;
this.flipStatus.horizontal = !this.flipStatus.horizontal;
if (this.isChrome) {
this.worker.postMessage({
Expand All @@ -755,6 +758,7 @@ class VideoUtils implements MediaUtilsInterface {
GEHelper.hFlipVideoElement(this.canvasVideo);
break;
case 'vflip':
this.flipStatus.isChanged = true;
this.flipStatus.vertical = !this.flipStatus.vertical;
GEHelper.vFlipVideoElement(this.canvasVideo);
break;
Expand Down Expand Up @@ -821,6 +825,7 @@ class VideoUtils implements MediaUtilsInterface {
this.disableAllModels();
GEHelper.resetHandlers();
this.turnOffWebcam();
this.flipStatus.isChanged = false;
if (!this.flipStatus.horizontal) {
this.setOptions('hflip', null);
}
Expand Down Expand Up @@ -864,6 +869,7 @@ class VideoUtils implements MediaUtilsInterface {
this.flipStatus = {
horizontal: false,
vertical: false,
isChanged: false,
};
this.objects = [];
this.poses = { predictions: [], adjacents: [] };
Expand Down

0 comments on commit 906af70

Please sign in to comment.