MongKong
31st March 2020, 19:50
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();
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();
Here is the error message:
13370
More error messages:
https://imgur.com/P0c8UKh
If anyone knows why does this happen, please help :(
Any help is appreciated !!!!
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();
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();
Here is the error message:
13370
More error messages:
https://imgur.com/P0c8UKh
If anyone knows why does this happen, please help :(
Any help is appreciated !!!!