I have been trying to play musics in my project, but sometimes randomly when I run my project (without re-compiling) this error happens and my file could not be played.
I am using OpenFL 3.0.0-beta3 legacy, and have tried every version of lime I had. In lime legacy 2.3.1 this problem seems to be more uncommon comparing to 2.1.2, but still happened a couple of times during test.
I think we may have just fixed this recently. There were a few file handles that were leaking, so if you loaded enough files, it might have prevented you from opening valid ones. If you’re working from the source, try the latest, otherwise it will go out soon enough
Oh… well good news anyways. Also there are some bugs regarding openfl hybrid, including the unstable framerate, unable to go fullscreen etc. I will wait for them to be fixed so that I will then be free of bugs I do hope that the fix can be done for legacy too, that would be fantastic.
If there is a simple test that could replicate the issue, it would be great to confirm that this is resolved in Lime 2 and show were the leaks can be patched in legacy
Umm, the test to replicate the issue is to load a music file at start up, and then repeatedly run the program over and over again. If the file never fails to load for at least 35 times then I think that will count as resolved
I just walked through the legacy code, and found places where there could be unclosed file pointers. I’m not sure if this is the cause of the problems you have had, but maybe it’s worth trying?
If this doesn’t do it, perhaps we can dig more and find the code path that is having trouble, still.
The paths I found were in the file loading code, like if it was trying to read a file that it did not detect to be a WAV or OGG file, otherwise, it looks like if you do type “music” and the sound channel is not stopped, it could end up not cleaning up the file handle, either. I have not tried looking to see if stop is called automatically at the end or not. Does it matter if you play the sound for the problem to occur? Does it happen just by loading it?
The problem only seems to happen during loading. Then if it wasn’t loaded properly the music can not be played. If it loaded properly then playing it has no problem. I 'll try the first PR asap.
I know this bug too. Sound won’t play at start. Exit. Run again. Chances 50:50
It only occurs with playMusic. Have you tried to delay loading/playing the sound some seconds, so it won’t be called directly at the start? Just an Idea.