[Qt-interest] Using phonon to play resources

Ian Clark mrrooster at gmail.com
Mon Jul 26 12:43:23 CEST 2010


Hi All,

I'm currently using Qt 4.6.3 (all platforms), and am having trouble
persuading Phonon to play an .mp3 file embedded in the application
resources.

>From the documentation it implies that this should work, however if I do:

mediaObject->setCurrentSource(Phonon::MediaSource(":/sounds/new_tweets.mp3"));

it doesn't work. (although this works correctly if given a local
filename), I've had to do:

 mediaObject->setCurrentSource(Phonon::MediaSource(new
QFile(":/sounds/new_tweets.mp3")));

Which isn't an issue, but does seem contrary to the documentation.

Should it work like I expect, or is this way okay? If I do it this way
do I need to ensure I delete the QFile explicitly?

Cheers,

Ian



More information about the Qt-interest-old mailing list