[Solved] .mp3 with Qt
-
I need to use this application on windows...
-
how to run .mp3 in Qt? Otherwise, how to open them with the default program (Media player and other)?
Edit: This was posted as a separate topic, but it clearly belongs to this topic; Andre
-
If you want to open the MP3 in the default application, just use something like this:
@
QUrl mp3Url = QUrl::fromLocalFile(theMp3FileName); //assuming you want to play a local file
QDesktopServices::openUrl(mp3Url);
@ -
0k. it starts, so thank you, but there is a problem: relative url dows not start..
-
Could you try if it works if you use a full path to the file, instead of a relative one?
-
yes, from full path it start.
@ QUrl mp3Url = QUrl::fromLocalFile("../qml/fileTrenner2/compleanno.mp3");
QDesktopServices::openUrl(mp3Url);
@ with relative path it does not start... -
Make sure your relative path is relative to "QDir::current()":http://doc.qt.nokia.com/4.7/qdir.html#current is. If it isn't you can always use
@QDir(QCoreApplication::applicationDirPath ()).absoulteFilePath("/path/")@ -
thank you. @
QString s = QDir::current().absolutePath().append("/qml/fileTrenner2/compleanno.mp3");
QUrl mp3Url = QUrl::fromLocalFile(s);
QDesktopServices::openUrl(mp3Url); @
this snippet starts! -
If I were you I'd still use applicationDirPath, because the working directory usually changes throughout your application and you cannot be sure that it points to where you want it to point.
-
i have this snippet:
@ QString s = QDir::current().absolutePath().append("/qml/fileTrenner2/compleanno.mp3");
QUrl mp3Url = QUrl::fromLocalFile(s);
QDesktopServices::openUrl(mp3Url); @
i want that the new window opens itself in minimized mode...or i want to move it.
how to do it? -
so, ideas for fixing?
-
If you just want to play a mp3 file, I ask you to use $yourFavoriteSearchEngine. There are plenty of threads on the internet dealing with that.
-
As loladiro suggested: use applicationDirPath.
-
I think you can figure it out yourself. I am happy to give you tips, but I'm not going to write your app for you (or even parts of it).
-
ahahah that is true! so, thanks!