Hello,
so i want to run background music on loop and i searched for it on how to do it on google and i found this bit of code:
playlist = new QMediaPlaylist();
playlist
->addMedia
(QUrl("qrc:/World_Sounds/BackgroundSound.wav"));
playlist->setPlaybackMode(QMediaPlaylist::Loop);
music = new QMediaPlayer();
music->setPlaylist(playlist);
music->play();
playlist = new QMediaPlaylist();
playlist->addMedia(QUrl("qrc:/World_Sounds/BackgroundSound.wav"));
playlist->setPlaybackMode(QMediaPlaylist::Loop);
music = new QMediaPlayer();
music->setPlaylist(playlist);
music->play();
To copy to clipboard, switch view to plain text mode
but this code crashes as soon as the first song stops playing ? (when it wants to loop)
but doing only this works, but the problem is it won't loop the media:
music = new QMediaPlayer();
music
->setMedia
(QUrl("qrc:/World_Sounds/BackgroundSound.wav"));
music->play();
music = new QMediaPlayer();
music->setMedia(QUrl("qrc:/World_Sounds/BackgroundSound.wav"));
music->play();
To copy to clipboard, switch view to plain text mode
Here is the error message:
File_2.PNG
More error messages:
https://imgur.com/P0c8UKh
If anyone knows why does this happen, please help
Any help is appreciated !!!!
Bookmarks