[Solved] Accessing "tags" from the "now" playing song in QMediaPlayer
-
Hi,
I 'm trying to access tags of the current song playing to display in my custom Media Player App.
I'm using this in media player to connect to a method to update the info.
@QObject::connect(this->playlist(), SIGNAL(currentMediaChanged(QMediaContent)),
this, SLOT(updateSongInfo()));@
updateSongInfo() Method:@gui->setProperty("songName", this->metaData("Title"));
gui->setProperty("albumName", this->metaData("AlbumTitle"));@Now, my issue is: I'm getting the song info of the previous song!!
I tried in many ways but I dn't find any solution for this.
Can any one help me how to get the current song info.EDIT: the details are from the previous song not from the next
Thanks in Advance,
inblueswithu -
Bump!!
-
Bump!!!
-
I resolved this issue.
Rather than asking currentMediaChanged() signal metaDataChanged() is more significant & reliable. I did this as following:@QObject::connect(this, SIGNAL(durationChanged(qint64)), this, SLOT(updateSongInfo()));
QObject::connect(this, SIGNAL(metaDataChanged()), this, SLOT(updateSongInfo()));@I'm not sure why the currentMediaChanged() did not work!
I even tried to pause the updateSongInfo() function to wait for few seconds to check if the player is not yet ready with the info. It didnt work.Thankyou :)