B4J Question MediaPlayer blocks mp3 files.

aberezhnykh

Member
Licensed User
Longtime User
I found that, without closing the application, I am unable to delete mp3 files that I previously played. Is there a way to release the files without closing the application. Thank you!

P.S. Win10
 

aberezhnykh

Member
Licensed User
Longtime User
Thank you, Erel!
Unfortunately, this method only works in the mp_Complete event.
If I call the "Stop" method, the "dispose" method still does not release the resources. :(
 
Upvote 0

aberezhnykh

Member
Licensed User
Longtime User
Unfortunately this also does not work. After initializing the player (even without the play), I still can not free the track. I'm depressed. Perhaps this is a mistake in Java library.
 
Upvote 0

AndiMars

New Member
Licensed User
Longtime User
Only my note to that:
Oracle recommend to not disposing the player if you want to continue playing files... (https://docs.oracle.com/javafx/2/api/javafx/scene/media/MediaPlayer.html#dispose()).

I have found out, that you can delete the files later, when you play other files in the meantime. So I simply try to delete the file and if that fails, I save it in a list. Then I try in a timer (eg. any 30s) to delete it again - this worked for me most of the time after one or two minute or so. Lastly, I save the list, and if necessary delete the files at the next program start...

Btw: I have also make some tries with disposing - then I was sometime able to delete the files instantly, but not always... So there was no big difference to my final solution - and I decided to follow the recommendation of Oracle.
 
Upvote 0
Top