I have only one mp3 file paying in background. I want that mp3 file to played till I close the application. What I am facing is that the mp3 file is played for only once and then stops. I want it to be played again. Find sample code below
Code:
QMediaPlayer *music = new QMediaPlayer();
music->setMedia(QUrl("qrc:/sounds/bgsound.mp3"));
music->setVolume(20);
music->play();
Thanks in advance!!
Simply do it by connecting signals and slots as follows:
connect(music,&QMediaPlayer::mediaStatusChanged,music,&QMediaPlayer::play);