Active Topics

 


Reply
Thread Tools
Posts: 1,086 | Thanked: 2,964 times | Joined on Jan 2010
#11
if it's in your qrc, try:

mediaObject->setCurrentSource(Phonon::MediaSource("qrc:/new/images/images/cow.mp3"))

is that path structure 'new/images/images/..' set up ok within your qrc?
__________________
Follow me on my neglected twitter @kojacker

Cybot950 - Control a robot with your N9/N950
SMSPetFeeder - Build a Bluetooth/SMS dog feeder with Qt, N950, and arduino
Nerf950 - Use your N9/N950 to fire a Nerf gun
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#12
Originally Posted by crabsody View Post
mediaObject->setCurrentSource(Phonon::MediaSource(":new/images/images/cow.mp3"))

it doesn't work
Shouldn't it be :/new/images/... etc as resource file path?

http://doc.qt.nokia.com/latest/resources.html
 

The Following User Says Thank You to gionni88 For This Useful Post:
vkv.raju's Avatar
Posts: 402 | Thanked: 451 times | Joined on Dec 2007 @ India
#13
Originally Posted by crabsody View Post
No. I found no errors. If I use this line

mediaObject->setCurrentSource(Phonon::MediaSource(":new/images/images/cow.mp3"))

it doesn't work

if I use this

mediaObject->setCurrentSource(Phonon::MediaSource("/home/grizos/NokiaQtSDK/Projects/Babytoy/music/cow.mp3"));

It works ok.!!!!

Very strange!! ??
I am not at all into Qt programming but this is what I got from this link: http://doc.qt.nokia.com/latest/phonon-mediasource.html . If you have already looked at it, then please ignore this...

Also, did you try entering this ":new/images/images/" into your windows explorer and see where it goes? My guess is that it might not be a valid path or URL!
 
crabsody's Avatar
Posts: 63 | Thanked: 12 times | Joined on Feb 2010 @ Thessaloniki Greece
#14
It seems that this is a bug of qt 4.6

http://bugreports.qt.nokia.com/browse/QTBUG-6562


I tried this workaround:

Code:
QFile *file = new QFile(":new/images/music/cow.mp3");
mediaObject->setCurrentSource(Phonon::MediaSource(file));
But now I got this warning when I try to play the sound

Code:
MediaSource::Stream not yet handled
 
crabsody's Avatar
Posts: 63 | Thanked: 12 times | Joined on Feb 2010 @ Thessaloniki Greece
#15
Haha. Well this warning is issued only with Qt Simulator. In my N900 works fine.. Thanks to all for the help....
 

The Following User Says Thank You to crabsody For This Useful Post:
Posts: 7 | Thanked: 3 times | Joined on Jul 2010
#16
Hello! Apologies for replying to an old thread.

I'm facing a problem with Phonon playback as well on Maemo, but on Symbian, Desktop and Qt Simulator the following code works 100%:

Code:
//QString url;
    url = ":/new/prefix1/a.mp3";

    //Phonon::MediaObject *music;
    music = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(url));

    //file exists, therefore exists is returned to the console
    if(QFile::exists(url))
        qDebug("exists");
    else
        qDebug("doesn't");

    //works if user selects the file:
    url = QFileDialog::getOpenFileName(this, tr("Select Music Files"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation));

    music->setCurrentSource(url);

    music->play();

    //no error is being outputed
    qDebug(music->errorString().toAscii());
Basically if I allow the user to select the file himself, it plays back. If I set the file path by code, it doesn't play back.

The file is there, as I check it with an if condition.

It only doesn't work on the N900, everywhere else if plays.

Any clue to what the problem might be?

Regards
Meraj
 
Reply


 
Forum Jump


All times are GMT. The time now is 05:10.