[FIXED][Qt5] QSound won't play any sound
-
@QSound soundTheme("warhorn.mp3"); //warhorn.wav won't work too ( i have both these files in there)
soundTheme.play();@the dir of the files is right, as i also have a picture-loading label which loads a .png from the same dir, a line before QSound attempt.
also tried using QSoundEffect, won't produce any sound just as well.
note: i've connected multimedia to QT+= in my .pro and ran qmake, app output won't tell anything. the app runs, the only issue is that the audio simply won't launch.
-
Hi,
How did you run your application?
Note that QSound and QSoundEffect are old classes which cannot play compressed files (like MP3 files). See their documentation:
If you want to play MP3 files, use QMediaPlayer.
-
[quote author="JKSH" date="1411832071"]Hi,
How did you run your application?
Note that QSound and QSoundEffect are old classes which cannot play compressed files (like MP3 files). See their documentation:
If you want to play MP3 files, use QMediaPlayer.[/quote]
*thanks for the note, yet it's not about the mp3, wav won't work just as well.
also seems like i did fix it with the QMediaPlayer class, thanks for that.