Play music with qt 5
-
hello i need to create a simple mp3 music player whith consola aplication , but i am a new in qt and i saw the examples of qt but i can understand nothing ...if someone can help me wiht a little example of the lines of code to play music ...and what i should write in the archive .pro y main.cpp
-
Hi,
It's explained in the first code sample "here":http://qt-project.org/doc/qt-5/qmediaplayer.html#details
-
thanks i can play music ...but now i need to add a list of song and play this list and i can change of song
mi code is :
this code only play the fisrt song ,when finish the song ,not change of song and begin to play again the first song
@include <QMediaPlayer>
include <QMediaPlaylist>
int main()
{
QMediaPlaylist *music_paul = new QMediaPlaylist;
music_paul->addMedia(QUrl("C:/Users/henrypaul/Music/qt/p3.mp3"));
music_paul->addMedia(QUrl("C:/Users/henrypaul/Music/qt/p4.mp3"));
music_paul->setCurrentIndex(1);QMediaPlayer *player = new QMediaPlayer;
player->setPlaylist(music_paul);while(true)
{
player->play();
}
return 0;
}
@[andreyc EDIT] Added @
-
Take a look on a "player example":http://qt-project.org/doc/qt-5/qtmultimediawidgets-player-example.html
-
I need to load a list of songs from a specific location
for example all songs of this directory "C:\Users\henrypaul\Music"but I do not want that I open any dialog window to select the files
for example
QStringList fileNames = QFileDialog::getOpenFileNames(this);
I DONT NEED THATI JUST NEED to write in my program the specific location and load this songs in a QStringList
-
QDir is your friend then
-
i try with QDir
but i can not use it correctly
do you help me with the specific code to use QDir please -
What do you mean by you can't use it correctly ?
What did you try ?
-
[quote author="paul_espinosa" date="1410551827"]i try with QDir
but i can not use it correctly
do you help me with the specific code to use QDir please [/quote]Hi paul_espinosa
if you want to get file(s) of a directory use from
@
QDir myDir(/ur directory path/);
QStringList FNames=myDir.entryList(QDir::Files);
@ -
Thank you for your help. I can build my project, but now I need to control my UI from internet from smarphone .. how could do that ??
-
Implement a web service that will talk to your player
-
some tutorial or example to implement a web service???
-
"Tufao":https://github.com/vinipsmaker/tufao is a Qt based web-framework and it has some examples.
-
hello my dears friends i have a new problem :( ..i have an aplication of play music on QT ,My application works well in mi pc ...
now my problem
i am working whith raspberry pi b+ and i can compilate my aplicacion in the raspberry but not play music :(
am instaled qt5 on raspberry ...do i need to install some more ???
some aplication of qt run very well ..but the music not play -
hello my dears friends i have a new problem :( ..i have an aplication of play music on QT ,My application works well in mi pc ...
now my problem
i am working whith raspberry pi b+ and i can compilate my aplicacion in the raspberry but not play music :(
am instaled qt5 on raspberry ...do i need to install some more ???
some aplication of qt run very well ..but the music not play -
Do you have any error message ?
-
Do you have any error message ?
-
un the terminal apear this
GLFS: Unable to query physical screen size, defaulting to 100 dpi.
EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
EGLFS: Unable to query screen depth, defaulting to 32.
EGLFS: To override, set QT_QPA_EGLFS_DEPTH.
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
This plugin does not support propagateSizeHints() -
un the terminal apear this
GLFS: Unable to query physical screen size, defaulting to 100 dpi.
EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
EGLFS: Unable to query screen depth, defaulting to 32.
EGLFS: To override, set QT_QPA_EGLFS_DEPTH.
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
This plugin does not support propagateSizeHints() -
Do it again but for define QT_DEBUG_PLUGINS=1