Open Georgieeeee opened 4 years ago
Yes that's a problem a never managed to solve until now, playing multiple songs in row. It's a bug :(
I am actually using an external Thread to call '.stop()' in XR3Player.
If it's playing on a thread, did you try to .join() the threads so that they are all combined so when new files are added to the thread, so that they can all be stopped at the same time
If the SteamplayerLister can trigger the files to open and play within the Status stopped then it will work, but the problem is that it's not possible to play files from within that
I have to find a solution on that
, now what i do is open and play a song in one Thread , i open one other thread which calls .stop()
which is blocking until the .stop()
returns , then inside that Thread i call again .open()
and .play()
to play the new song and it exits.
.play()
is using it's own Thread to play the song.It's just the .stop()
that is blocking the Thread that is called from.
The problem is we need a mechanism to know when the previous song ended which i have not implemented .
I've now run into this issue in my own program. Will have to look into it cause it's a blocker for my use case :P
Mmm i have solved that in the past in XR3Player.
I was using JavaFX and for each player i had a Thread Service. Everytime i want to stop a song i was calling stop from a Thread different than the main thread so it doesn't freezes.
O gosh i have solved all that in XR3Player i hope there is not bugs in new Stream-Player library version.
On Wed, 15 Apr 2020, 04:41 Andrew O., notifications@github.com wrote:
I've now run into this issue in my own program. Will have to look into it cause it's a blocker for my use case :P
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/goxr3plus/java-stream-player/issues/54#issuecomment-613766521, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3OFQCLMD5GSKXXFB5PJDLRMUGDZANCNFSM4J2G322Q .
Mmm i have solved that in the past in XR3Player. I was using JavaFX and for each player i had a Thread Service. Everytime i want to stop a song i was calling stop from a Thread different than the main thread so it doesn't freezes. O gosh i have solved all that in XR3Player i hope there is not bugs in new Stream-Player library version.
Thanks for the reply @goxr3plus :)
In my case, I only have one player (StreamPlayer) instance. It's being instantiated with a SingleThreadExecutor (such as here). I don't know if this is relevant to your solution however, just wanted to give more details.
To give more context of my application, the UI presents the user with a list of audio files. When an audio file is hovered on (by pressing up/down on the arrow keys), the song is played. When the user presses the up or down arrow key several times in a row, the UI freezes up and each song traversed is played a bit before changing to the next.
You mentioned that you were calling stop from a different thread than the main thread so that it doesn't freeze. I tried calling stop (and open + play) from a CompletableFuture.runAsync()
which seems to prevent the UI from freezing up, but two issues arise when multiple stop/play attempts are made in quick succession:
I'm not sure if you have any ideas on what could be going on in these two cases, but figured I'd mention it :)
Also I just checked out https://github.com/goxr3plus/XR3Player, it looks amazing :D I'll try to inspect how it works and compare it to my (much simpler) application :)
Hm thank you very much for mentioning those problems, i think you will need to go into deeper investigation of how this library works then.
Do me one favor try the previous version, the 9.0.4 which had my old architecture and tell me if you face the same problem there. I have never tested the 10 version for multithreading issues, on the other side 9.0.4 is battle tested on XR3Player.
Hey on XR3Plager have a look at this class to see exactly how i do it :
Go on the method playSong line 2120. This class has all the logic you need for the player. Please do some reverse engineer there i hope the method names help you.
I know you will have problem with the logger there but i just need to know if we introduced any bug with the version 10
@AObuchow Tell me how it is going for you :)
I just had a look on XR3Player and had nostalgia , i might restart working it on Java 14 with the latest and greatest features and add some streaming services :)
Hm thank you very much for mentioning those problems, i think you will need to go into deeper investigation of how this library works then.
Do me one favor try the previous version, the 9.0.4 which had my old architecture and tell me if you face the same problem there. I have never tested the 10 version for multithreading issues, on the other side 9.0.4 is battle tested on XR3Player.
Hey on XR3Plager have a look at this class to see exactly how i do it :
Go on the method playSong line 2120. This class has all the logic you need for the player. Please do some reverse engineer there i hope the method names help you.
I know you will have problem with the logger there but i just need to know if we introduced any bug with the version 10
Thanks so much for giving me a reference point :) I’ll try it out when I have a moment, sorry for the delayed reply! I really appreciate the detailed response. It helps a lot :)
@AObuchow Tell me how it is going for you :)
I just had a look on XR3Player and had nostalgia , i might restart working it on Java 14 with the latest and greatest features and add some streaming services :)
Things are going well! I just took a break from the asynchronous audio player bug and worked on other features of my audio-file manager :) I’ve also been dealing with another side project which needs to be completed by May 1st so that’s taking priority.
I promise I’ll get back to it though so I can follow up with you :)
As for continuing the development of XR3Player - YES!! I think that’s a great idea, it’s a really cool application and some of the Java 14 features look really nice to use (I’ve been meaning to try them out myself!)
Looking forward to it :)
If multiple audio files are opened and played, they play one after each other, but it freezes the program where actions like .stop(), etc can't be used, which is a problem as now all files that are queued can't be stopped. Is there a way to fix this?