Closed seeseekey closed 1 month ago
Thank you for your reporting your first LITIENGINE issue! We are looking forward to your further contributions.
Thanks for the report! Why would you want to initialize a MusicPlayback that already exists in the first place? I suggest instead to pause the MusicPlayback directly:
// considering there is already a Sound Resource with the music you want to play, use the String parameter for `playMusic`.
Game.audio().playMusic("endless-nights.ogg");
// access the MusicPlayback
MusicPlayback mp = Game.audio().getMusic();
// pause and resume
mp.pausePlayback();
mp.resumePlayback();
// stop and restart
mp.cancel();
mp.run();
It's a "slide-based" approach. There are some different slides defined in a JSON file. If one slide is loaded a new screen for the slide is started and a music resource would be played. In some cases two slides with the same music comes successively.
Sure, technically I can check if the music file is the same and only restart it, but from the outer view if I start a music via Game.audio().playMusic I want that the engine plays the music instead of being silent.
In that case, this is not a bug. You can simply use Game.audio().playMusic(Track track, boolean restart)
to check if the new track is equal to the one currently playing and restart it.
Implemented and tested, works perfect. Thanks :)
awesome - happy coding!
Describe the bug If i want play a song twice (play song, stop it, play it again), the second attempt doesn't work. It need to play another song first to play the first song again.
To Reproduce
Expected behavior Song should be started, then stopped, then again started.
Your System: