View Single Post
Posts: 1,048 | Thanked: 979 times | Joined on Mar 2008 @ SF Bay Area
#7
Originally Posted by tmsha View Post
I did the following:

Code:
QFileInfo info("ballhit.wav");
QString strFullname = info.absoluteFilePath ();
QMediaPlayer *player = new QMediaPlayer;
player->setMedia(QUrl::fromLocalFile(strFullname));
It does not work...
info.exists()
and
info.isFile()
both returns false...

How did you include your file with the project?
Where is ballhit.wav with respect to your executable binary?
Is it in the same directory? Then try "./ballhit.wav"

Use QFileInfo::exists to find out if your executable binary exists where you think it does. How do you execute your app? Do you do it from the same directory as the wave file?
The "." in "./ballhit.wav" typically means "current directory" which is the directory in which you started running your app.

Edit:
Also: My media files are generated on the fly. So my case isn't exactly like yours.
__________________
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: