java-stream-player
java-stream-player copied to clipboard
seekSeconds doesn't work for flac files
I have just tried a little, but it seems that seekSeconds doesn't work if the audio file is a flac file.
https://github.com/goxr3plus/java-stream-player/blob/634c9912c38437285faf5644b4046bb5546db597/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java#L715-L727
Part of the problem is in TimeTool.durationInMilliseconds_Part2(), where the value on line 110 fall through if the file extension is not mp3, wav or ogg.
https://github.com/goxr3plus/java-stream-player/blob/634c9912c38437285faf5644b4046bb5546db597/src/main/java/com/goxr3plus/streamplayer/tools/TimeTool.java#L117-L120
This leads to an exception. UnsupportedOperationException: Trying to skip with seconds {15} > maximum {-1}
If this value is changed to 1000000 (1000 seconds), this exception doesn't happen. But the seek still doesn't happen. That's as far as I have investigated.
See also https://github.com/HelgeStenstrom/java-stream-player/tree/appWithFlac
That's true , i don't know why it happens :(
Also ran into this issue and it seems the underlying issue is with the org.jflac library not supporting skipping even when I worked around the issues with TimeTool. Hopefully, this issue can be fixed soon?
Dec 19, 2021 7:57:41 PM com.goxr3plus.streamplayer.stream.StreamPlayer seekBytes WARNING: skip not supported java.io.IOException: skip not supported at org.jflac.sound.spi.RingedAudioInputStream.skip(RingedAudioInputStream.java:374)
Oups well to bypass that with XR3Player I used Jave2 library which I am a coauthor and converted everything to mp3 before playing them. So everything worked perfectly.
Have a look at Jave2 repository on github.
Well it's been time since I last supported this repo. I am a mobile and web developer now.
https://github.com/a-schild/jave2
Thanks for the info.