QMediaPlayer. Issue with playing the video in Reverse
-
Hello, this is my void that plays video using QMediaPlayer. I tried to look for something in the internet to play my video in reverse while using QMediaPlayer, but didn`t find what will work for me. Maybe I was wrong somewhere.
Can anybody help to write code, so when the video will be played, the video will be played in reverse?P.S. Also I have an issue that the video is not played while using the path from resources and working only the path that is in the code. Maybe anybody knows anything about this issue
void Form::on_pushButton_6_clicked() { clickCountButton6++; int currentTabIndex = ui->tabWidget->currentIndex(); static QMediaPlayer *player = nullptr; static QVideoWidget *videoWidget = nullptr; if (currentTabIndex == 0) { if (clickCountButton6 == 1 && clickCountButton2 != 0) { ui->label_17->lower(); if (!videoWidget) { videoWidget = new QVideoWidget(ui->tabWidget->widget(0)); videoWidget->resize(605, 482); videoWidget->move(1317, 213); connect(videoWidget, &QObject::destroyed, this, &Form::onVideoWidgetDestroyed); } if (!player) { player = new QMediaPlayer(videoWidget); player->setVideoOutput(videoWidget); QString videoPath("F:/Mongoose Throw/Gepard/Videos/Sonar_Radar.avi"); player->stop(); player->setSource(QUrl::fromLocalFile(QFileInfo(videoPath).absoluteFilePath())); player->setLoops(QMediaPlayer::Infinite); } player->play(); videoWidget->show(); } else if (clickCountButton6 == 1) { ui->label_17->lower(); } else if (clickCountButton6 == 2) { ui->label_17->raise(); clickCountButton6 = 0; if (player) { player->stop(); delete player; player = nullptr; } if (videoWidget) { videoWidget->close(); delete videoWidget; videoWidget = nullptr; } } ui->pushButton_6->raise(); } }
-
Hi and welcome to devnet,
Which version of Qt are you using ?
To the best of my knowledge, there's no option for reverse play.
As for the resource issue, the native backends cannot access the files within the resources. You have to copy the file in a temporary location and play it from there.