Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[qt5] QMediaPlayer - i can`t get metaData :/

$
0
0
Hi I try to get the meta data of music file (i try different files and udio formats mp3 wav etc) all files are good becaouse other players shows meta data :C I try it on different ways but no one method work :/ my code: testPlayer = new QMediaPlayer;     playList = new QMediaPlaylist;       testPlayer->setVolume(50); // testPlayer->setMedia(QUrl::fromLocalFile("test2.mp3")); // try without playlist -> dont work :C     playList->addMedia(QUrl::fromLocalFile("test2.mp3"));     testPlayer->setPlaylist(playList);     playList->setCurrentIndex(0);     qDebug() << "Test: " << testPlayer->metaData(QMediaMetaData::Title);       connect(testPlayer, SIGNAL(metaDataChanged()), this, SLOT(stc()));       stc(); void MainWindow::stc() {     qDebug() << testPlayer->isMetaDataAvailable();     if(testPlayer->isMetaDataAvailable())     {         qDebug() << testPlayer->metaData(QMediaMetaData::Duration);     } } and i always get result data Test: QVariant(Invalid) false false false false what i do wrong :C ? please help

Viewing all articles
Browse latest Browse all 18427

Trending Articles