View Single 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