[QtMultimedia] How to read metaData from all mediaObject in QMediaPlayList ?
-
Hey. I read metaData in SLOT
@connect(&musicPlayer, SIGNAL(metaDataAvailableChanged(bool)), this, SLOT(updateInfo()));void PlayerWindow::updateInfo()
{
QString author = musicPlayer.metaData("Author").toString();QString title = musicPlayer.metaData("Title").toString(); qDebug() << author << " - " << title; musicPlayList.next();
}@
and load files to playList
@void PlayerWindow::on_pushButton_clicked()
{
static QString path = QDir::homePath();
QStringList filePaths = QFileDialog::getOpenFileNames(this, tr("Open File"), path, tr("MP3 files (.mp3);;All files (.*)"));if(!filePaths.empty()) { for(int i = 0; i<filePaths.size(); i++) { musicPlayList.addMedia(QUrl::fromLocalFile(filePaths[i])); } musicPlayList.setCurrentIndex(0); }
}@
And this is too slow i think becouse it read metaData only for every second file.
So my question is how to do this right to get metaData of all files in QMediaPlayList