I was trying to program a really simple audio player using QtMultimedia in qt5. I used a code like this:
AudioPlayer::AudioPlayer(QWidget* parent): QWidget(parent)
{
//some code
audioPlayer = new QMediaPlayer;
audioPlayer -> setMedia(QUrl::fromLocalFile("/home/davide/Music.mp3"));
audioPlayer -> setVolume(50);
audioPlayer -> play();
//some other code
}
This code compiles fine, but when I run it I get the message: <> and the audio doesn't play...
I tried playing a wav audio file, and it works fine so I think the problem is in the mp3 format.
Thanks in advance and sorry for my bad english.
Aucun commentaire:
Enregistrer un commentaire