[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 << " - " <&lt; 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&lt;filePaths.size(); i++)
        {
            musicPlayList.addMedia(QUrl::fromLocalFile&#40;filePaths[i]&#41;);
        }
        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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.