Solved isMetaDataAvailable() isn'twork..
-
So i'm basically working on a music player and i have a line of code that checks if a music file has metadata associated with it so it can get some data of the music file but it doesn't work and the issue is that
isMetaDataAvailable()
evaluates to false even when the music file has metadata. As you can see i used an application to check if the music file has metadata and it does so why doesisMetaDataAvailable()
evaluate to false
Here is the code:
-
@Padawan From https://doc.qt.io/qt-5/qmediaplayer.html#setMedia :
"Note: This function returns immediately after recording the specified source of the media. It does not wait for the media to finish loading and does not check for errors. Listen for the mediaStatusChanged() and error() signals to be notified when the media is loaded and when an error occurs during loading.".
I suggest you call isMetaDataAvailable in a slot connected to mediaStatusChanged(). -
@Padawan From https://doc.qt.io/qt-5/qmediaplayer.html#setMedia :
"Note: This function returns immediately after recording the specified source of the media. It does not wait for the media to finish loading and does not check for errors. Listen for the mediaStatusChanged() and error() signals to be notified when the media is loaded and when an error occurs during loading.".
I suggest you call isMetaDataAvailable in a slot connected to mediaStatusChanged(). -
@jsulm thanks, it worked, i made a slot that connects to that signal and checks if the media is in a
BufferedMedia
State and it works fine now -
For anyone wanting to know, i connected a slot function to the
mediaStatusChanged()
signal and the function checks if it's in aBufferedMedia
state which would mean it would have finished loading the media fully and it would possess the metadata(if the media has one) and it works as i intended now;