How To Distribute Phonon Apps With Qt 4.8.7

The Phonon documentation provided by Qt isn’t thorough because Qt stopped providing support for it after awhile. So you’ll have to do extensive scouring of the Internet to make even your most basic Phonon app work. Here’s how:

When you’re coding, you can add the #includes, but you’ll notice the compiler may give errors. That’s because you have to dig pretty deep in the Phonon documentation provided by Qt in order to find out how to use their moc system. So make sure you add:

Qt += phonon

to the line in your QCreator *.pro file before you compile your application.

So when it’s time to deploy, make sure when you distribute your Phonon-based application to copy these folders to be distributed with your final Windows self-executable (*.exe format), which can be found in your Qt 4.8.7 installation folder %Qt%/plugins/

/phonon_backend
/codecs

You’ll also need the following DLLs to be distributed too, so copy them from Qt installation folder %Qt%/bin/

-QtDBus4.dll
-QtXml4.dll
-phonon4.dll

So once these folders and files have been distributed with your Windows self-executable, you should be able to play basic media files such as WAV and AVI formats. Other formats like MPG, MP3, MP4, AAC, MIDI, WMV, MOV, OGG, FLV may require additional codecs and programming. But the only way you’ll know for sure is to test them. Otherwise stick with formats you know for sure Windows (or your target deployment operating system) supports.

Hope that helps!

CategoriesQt