View Single Post
Posts: 1,048 | Thanked: 979 times | Joined on Mar 2008 @ SF Bay Area
#4
Originally Posted by tmsha View Post
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
I had this problem, and the only way I could fix it was to do the following:
Code:
QFileInfo info (path);
if (!info.exists ()) {
    // error out
}
QString strFullname = info.absoluteFilePath ();
player.setMedia (QUrl::fromLocalFile(strFullname));
__________________
qgvdial: Google Voice client. All downloads
qgvtp: Phone integration for the n900 that dials out and sends texts using qgvdial.
mosquitto: message broker that implements the MQ Telemetry Transport protocol version 3.
qgvnotify: Google voice and contacts notifier for diablo and maemo.

If you want to thank me, click the Thanks button.
If you'd like to thank my applications, vote to move them to extras.
 

The Following User Says Thank You to uvatbc For This Useful Post: