admin管理员组文章数量:1428091
I try to get current time with player->position()
, but in the debug() I see not all frames, even I set timer update speed to 1 ms.
Debug output: 1828 1828 1828 1880 1880 1880 1933 1933
Seems that QMediaPlayer::positionChanged
updates about 50ms at time.
How I can get more accurate frame counter?
Example code:
QMediaPlayer *player;
QTimer *timer;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
player = new QMediaPlayer(this);
timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &MainWindow::updateTime);
}
void MainWindow::on_pushButton_clicked()
{
QAudioOutput *audioOutput = new QAudioOutput(this);
player->setAudioOutput(audioOutput);
player->setSource(QUrl::fromLocalFile("test.mp3"));
player->play();
timer->start(10);
}
void MainWindow::updateTime()
{
qDebug() << player->position();
}
本文标签: cQMediaPlayer QT6 How to get more accurate current file positionStack Overflow
版权声明:本文标题:c++ - QMediaPlayer QT6 How to get more accurate current file position? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745515233a2661496.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论