Important: Please read the Qt Code of Conduct -

Play sound in ubuntu linux suggestion

  • Hello developers :)
    QSound apparently doesn't work for linux because it requires NAS or something like this that it's not default and I don't want dependencies like this...

    So, I've seen some libraries such as QtMultimedia or QAudioOutput that look really interesting (I don't want to use phonon because it is huge and I just want to play an audio file, nothing more) but they are not available (maybe available only for mobile programming if correct?)!
    Why is this? What do you suggest me to do?
    I run this version of Qt:
    Qt 2.1.0 based on Qt 4.7.2 (32 bit)
    and, as always, thanks in advance for any answers :) :)

  • They ARE available even on desktop. You could just include the QtMultimedia module (QT += multimedia), but it's a much better idea to use the one available from QtMobility.

  • Use QMediaPlayer!
    It is part of Mobility. Ubuntu users find it in package qtmobility-dev

    Mobility comes with a media player example.

  • Hey, thanks, I have already tried including QT += multimedia in the project file but I got
    @/usr/bin/ld: cannot find -lQtMultimedia@ so I assumed it's not available :/

  • Since mobility lives outside Qt the build system integration does not work reliably. It all depends on where Mobility is located.

    If you have good luck this works:
    @CONFIG += mobility
    MOBILITY = multimedia@

    If not do not despair. Simply add two includepathes (to QtMulitmediaKit and QtMobility) and a link path.

  • Thanks, the last one worked fine :)

Log in to reply