![]() |
N900 QMediaPlayer
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; 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 :) |
Re: N900 QMediaPlayer
have you tryed adding it to the qrc file. im no expert but i do that with all my graphics befor i load them. This i think imbeds them in the executable tho which means its not optifyed. so before uploading to extras or testing you will have to work out how to load them from file and add them to the opt folder for your app.
What i know is in a browser you would use file:// to access a local file instead of a remote webservers file. but if i am loading a image from file in qt i would pass the string ":sprites/image.png" sprites being the folder in the src directory that holds the images. image.png being the image in the folder. for you this would be something like ":sounds/sounds1.wav" or maybe "file://sounds/sound1.wav" |
Re: N900 QMediaPlayer
Thank you, I have tried to add the file to my resource file, and also tried all your suggestions, but it still does not work.
|
Re: N900 QMediaPlayer
Quote:
Code:
QFileInfo info (path); |
Re: N900 QMediaPlayer
thank you :D I will try it
|
Re: N900 QMediaPlayer
I did the following:
Code:
QFileInfo info("ballhit.wav"); info.exists() and info.isFile() both returns false... :( How did you include your file with the project? |
Re: N900 QMediaPlayer
Quote:
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. |
Re: N900 QMediaPlayer
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” |
Re: N900 QMediaPlayer
Quote:
"target" is a tag for your executable binary. Any additional files that you want installed need to come with additional tags. In my pro file, these additional tags for my maemo5 binary are "desktop" "icon" "qss" etc. After defining that INSTALLS needs to have extra tags, I also specified where the files in every tag should fall (tag.path) and what the source file is on my dev machine (tag.files). Once you do all that, your deb should have everything you need. Also: once you actually build your deb, its a good idea to go into the debian sub directory and see the directory structure in there to confirm that the deb-helpers have done what you wanted. Remember that a deb is a compressed archive of: 1. All the files you said need to be installed (binary, media files, whatever else) 2. Control scripts to pick up things from a deb and put them into the correct corresponding locations on the user machine 3. Dependency and other meta information |
Re: N900 QMediaPlayer
Thank you so much! That is exactly what I was looking for (I think).
I remember using code like that in my pro file when I was working on scratchbox :) I will try it out now! |
All times are GMT. The time now is 05:38. |
vBulletin® Version 3.8.8