PDA

View Full Version : Phonon Cannot Play Sound (without Error)



padawan
30th July 2009, 07:44
Hi,
I am trying to build a simple Phonon application. I have tried a simple code like:



QApplication::setApplicationName("panda");
QList<AudioOutputDevice> ss=Phonon::BackendCapabilities::availableAudioOutp utDevices();
MediaObject *m_media;
m_media = new Phonon::MediaObject(this);
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
//audioOutput->setOutputDevice(Phonon::AudioOutputDevice::fromInd ex((((AudioOutputDevice)ss.at(0)).index())));
createPath(m_media, audioOutput);
MediaSource m=MediaSource("/FileSpace/n.mp3");
m_media->setCurrentSource(m);
m_media->play();


This code compiled and ran w/o any error, however I do not get any output.

I have also tried Media Player example in Qt site, in that, when I push play button immediately playing ends.

Any thoughts or comments?

yogeshgokul
30th July 2009, 07:56
This code compiled and ran w/o any error, however I do not get any output.
On what os platform you are trying?



QList<AudioOutputDevice> ss=Phonon::BackendCapabilities::availableAudioOutp utDevices();

Can you please get the count of ss?



I have also tried Media Player example in Qt site, in that, when I push play button immediately playing ends.

What is the length of sound file you tried with?

padawan
30th July 2009, 09:19
On what os platform you are trying?

xubuntu linux


Can you please get the count of ss?

3;
10001 - ALSA default output
10002 - OSS default output
10000 - PulseAudio

BTW, I have tried to change output device by uncommenting the line you mentioned and using 3 different IDs



What is the length of sound file you tried with?

a few minutes long mp3 song

yogeshgokul
30th July 2009, 09:31
Check for "gstreamer", is it properly installed on your environment. Well I guess, it is. Thats why you are getting the list of 3 devices.
Check is you can playback mp3 on same environment by any tool. This will test for sound codecs and output devices.

padawan
30th July 2009, 19:00
Hi,
gstreamer and some related packages are installed (but not everything that contains gsreamer), but anyway, MP3 playback is without problem in the system with any other software.

TTGator
16th September 2009, 15:17
Try running it with PHONON_GST_DEBUG=3. For example, to run "myApp"

PHONON_GST_DEBUG=3 ./myApp -qws

It outputs a lot of helpful info of what's actually going wrong