![]() |
2010-10-28
, 21:24
|
Posts: 200 |
Thanked: 44 times |
Joined on Jan 2010
|
#2
|
The Following User Says Thank You to jamie721 For This Useful Post: | ||
![]() |
2010-10-28
, 21:36
|
Posts: 60 |
Thanked: 23 times |
Joined on Jan 2010
|
#3
|
![]() |
2010-10-28
, 21:39
|
Posts: 1,048 |
Thanked: 979 times |
Joined on Mar 2008
@ SF Bay Area
|
#4
|
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
QFileInfo info (path); if (!info.exists ()) { // error out } QString strFullname = info.absoluteFilePath (); player.setMedia (QUrl::fromLocalFile(strFullname));
The Following User Says Thank You to uvatbc For This Useful Post: | ||
![]() |
2010-10-28
, 21:53
|
Posts: 60 |
Thanked: 23 times |
Joined on Jan 2010
|
#6
|
QFileInfo info("ballhit.wav"); QString strFullname = info.absoluteFilePath (); QMediaPlayer *player = new QMediaPlayer; player->setMedia(QUrl::fromLocalFile(strFullname));
![]() |
2010-10-28
, 23:05
|
Posts: 1,048 |
Thanked: 979 times |
Joined on Mar 2008
@ SF Bay Area
|
#7
|
I did the following:
It does not work...Code:QFileInfo info("ballhit.wav"); QString strFullname = info.absoluteFilePath (); QMediaPlayer *player = new QMediaPlayer; player->setMedia(QUrl::fromLocalFile(strFullname));
info.exists()
and
info.isFile()
both returns false...
How did you include your file with the project?
The Following User Says Thank You to uvatbc For This Useful Post: | ||
![]() |
2010-10-28
, 23:20
|
Posts: 60 |
Thanked: 23 times |
Joined on Jan 2010
|
#8
|
![]() |
2010-10-28
, 23:33
|
Posts: 1,048 |
Thanked: 979 times |
Joined on Mar 2008
@ SF Bay Area
|
#9
|
Thank you for your replay.
I have found the path of the executable to be: ”/usr/local/bin/” but there is no “ballhit.wav” in that dir.
I can go to that dir and do ./app and it runs like normal, but the sounds does not work.
I did a “find . -name “ballhit.wav”” with root and found nothing on the phone.
So, the file has not been copied ?
How can I ensure the file is copied and installed with the executable?
I think that is my problem.. I need to copy the file over to the phone when i run it from Qt Creator.
I have done the following in an attempt to fix it:
In the same folder as src.pro i got ballhit.wav, and in src.pro i added this:
OTHER_FILES += ballhit.wav
target.path = $$DESTDIR
target.files += ballhit.wav
INSTALLS += target
I have also added a build step: “make install”
The Following User Says Thank You to uvatbc For This Useful Post: | ||
![]() |
2010-10-28
, 23:54
|
Posts: 60 |
Thanked: 23 times |
Joined on Jan 2010
|
#10
|
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