I got this bit of code that I run on a N900 with PR1.3 Qt4.7 Mobility 1.0.2 Code: QMediaPlayer *player = new QMediaPlayer; player->setMedia(QUrl::fromLocalFile("ballhit.wav")); player->setVolume(50); player->play(); When I run it, this happends: GStreamer; Unable to play – “file:ballhit.wav” I think that it may not find the file, I have tried many different methods of adding the wav file to my project, but none seems to work, I don’t know what is the best approach. If i replace “ballhit.wav” with for example: ”Http://tst.com/b.wav”, it works, no problem. But I can’t load my sound files from the web, I want them on the device. Developing on windows with Qt Creator. Please help me
QMediaPlayer *player = new QMediaPlayer; player->setMedia(QUrl::fromLocalFile("ballhit.wav")); player->setVolume(50); player->play();
QFileInfo info (path); if (!info.exists ()) { // error out } QString strFullname = info.absoluteFilePath (); player.setMedia (QUrl::fromLocalFile(strFullname));