Skip to content

Commit

Permalink
Calculate video duration and max timeout only after video is loaded.
Browse files Browse the repository at this point in the history
This was causing the UI timeout to always resolve to 0, leading to immediate failure after video upload.

Change-Id: I15d508a97c1b80b0cdb950612fd8f59ba1da7cbc
  • Loading branch information
mohabfekry committed Oct 18, 2024
1 parent e9524c0 commit 37f4dec
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions ui/src/ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,14 @@ export class AppComponent {
this.calculateVideoDefaultDuration(
this.previewVideoElem.nativeElement.duration
);
// Increments by 1 for every additional video minute
const minutesFactor =
Math.floor((this.previewVideoElem.nativeElement.duration - 1) / 60) + 1;
// Wait a total of 10 minutes per minute of video, for a max of 1 hour
this.maxRetries = Math.min(
this.maxRetries * minutesFactor,
CONFIG.maxRetries
);
this.previewVideoElem.nativeElement.onloadeddata = null;
};
this.previewVideoElem.nativeElement.onplaying = () => {
Expand All @@ -615,16 +623,6 @@ export class AppComponent {
};
this.videoUploadPanel.close();
this.videoMagicPanel.open();

// Increments by 1 for every additional video minute
const minutesFactor =
Math.floor((this.previewVideoElem.nativeElement.duration - 1) / 60) + 1;

// Wait a total of 10 minutes per minute of video, for a max of 1 hour
this.maxRetries = Math.min(
this.maxRetries * minutesFactor,
CONFIG.maxRetries
);
this.getSubtitlesTrack(folder);
}

Expand Down

0 comments on commit 37f4dec

Please sign in to comment.