How to play list of audio files in Qt 6.4 ?
-
Hi, My application was using QMediaPlayer and QMediaPlaylist to play audio files.
List of audio files need to be played together. QMediaPlaylist helped to do that.
But now, when we are trying to upgrade to qt 6.4.Since QMediaPlaylist is not available in qt 6.x,
I have replaced m_playlist->addMedia(QUrl::fromLocalFile(acuFile));
with
m_player->setSource(QUrl::fromLocalFile(acuFile));But , the issue is I have a list of audio files that should be played together. And now only the last set file is getting played.
What is the correct way to play a list of audio files in Qt 6.x ?
-
@Parvathy2020 said in How to play list of audio files in Qt 6.4 ?:
QMediaPlaylist
The source code of QMediaPlaylist is here. You build it with you project.
https://code.qt.io/cgit/qt/qtmultimedia.git/tree/examples/multimedia/player/qmediaplaylist.cpp?h=6.4
https://code.qt.io/cgit/qt/qtmultimedia.git/tree/examples/multimedia/player/qmediaplaylist.h?h=6.4
https://code.qt.io/cgit/qt/qtmultimedia.git/tree/examples/multimedia/player/qmediaplaylist_p.h?h=6.4 -
@JoeCFD Hi, Thanks for your reply.
I have added the above listed .cpp and header files in my project. But it is throwing many errors:
/home/pbabu/code/tsdop/tsdop/tsdopmain/inc/qmediaplaylist_p.h:16: error: qplaylistfileparser_p.h: No such file or directory
In file included from ../../tsdop/tsdopmain/src/qmediaplaylist.cpp:2:
../../tsdop/tsdopmain/inc/qmediaplaylist_p.h:16:10: fatal error: qplaylistfileparser_p.h: No such file or directory
16 | #include "qplaylistfileparser_p.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/pbabu/code/tsdop/tsdop/tsdopmain/src/qmediaplaylist.cpp:433: error: ‘class QMediaPlaylistPrivate’ has no member named ‘parser’
../../tsdop/tsdopmain/src/qmediaplaylist.cpp: In member function ‘void QMediaPlaylist::load(QIODevice*, const char*)’:
../../tsdop/tsdopmain/src/qmediaplaylist.cpp:433:8: error: ‘class QMediaPlaylistPrivate’ has no member named ‘parser’
433 | d->parser->start(device, QString::fromUtf8(format));
| ^~~~~~Will these 3 files alone enough for the successful build?
Is there any other way to get this work ?
-
https://code.qt.io/cgit/qt/qtmultimedia.git/tree/examples/multimedia/player/player.pro?h=6.4
you do need more which are there.