0

I've been trying to get the duration of a video file that's opened but whenever I open the file the duration always comes out to 00:00:00. I believe the logic and math are correct but that I am possibly missing a connection.

GitHub

void MainWindow::updateDurationInfo(qint64 duration) {
 int seconds = (duration/1000) % 60;
 int minutes = (duration/60000) % 60;
 int hours = (duration/3600000) % 24;

QTime time(hours, minutes,seconds);

ui->label->setText(time.toString()); }

updateDurationInfo(player->duration());
  • `QTime time = QTime::fromMSecsSinceStartOfDay(duration);` would be simpler. Please show a [mre] in the question without relying on external links – Alan Birtles Oct 04 '22 at 06:58
  • Please provide enough code so others can better understand or reproduce the problem. – Community Oct 04 '22 at 11:25

1 Answers1

0

You set current position only in construction of window, but doesn't change it. Try to connect signal that emit when player position changed to updateDurationInfo

TheRyuTeam
  • 233
  • 1
  • 6