[Qt-interest] Troubles playing sounds with Phonon on linux, Qt 4.6.2

Harri Pasanen grego at mpaja.com
Fri Nov 5 02:20:21 CET 2010


Hi,

I'm on Kubuntu 10.04 AMD64, using systems Qt 4.6.2, and Qt Simulator, also 
playing with remote compiler in Qt Creator for S60 5th edition Qt 4.6.3 
target.

Couple of things I noticed:

Out of the box Simulator build did not like <Phonon/MediaObject>, wanted 
<MediaObject>.  For Desktop it was the inverse.

First I was trying to play a file from a qrc resource without using MediaSource 
trusting the documentation that a string was all that was required, magic 
constructors would build the MediaSource for me.    Did not work.  First try 
with "hello.mp3" did not compile, converting it to QString made it to compile, 
but still no sound.  

I then fired up qmediaplayer demo, and to my relief that worked.  
Examining its source I noticed three things: 1. it was using MediaSource, 2. 
all samples were ogg, 3. it was not using resource as source, just files.

So by explicitly using MediaSource and files I managed to make it work for 
oggs.

mp3's would not play on Linux.  After some doc reading and googling I found 
that 

  sudo apt-get install gstreamer0.10-fluendo-plugins-mp3

is required for it to work.  That was non-obvious, as everything else was 
already playing mp3s.


Now only I'm left with the fact that MediaSource does not seem to work when 
the source is from resource, like  ":/res/sound.mp3".  Is this a known 
problem?  

Not a major problem for me, sound files tend to be on the big side for 
resources, but some smaller samples could well be there.


Regards,

-- 
Grego
http://mpaja.com/



More information about the Qt-interest-old mailing list