-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
I have just tried a little, but it seems that seekSeconds doesn't work if the audio file is a flac file.
java-stream-player/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java
Lines 715 to 727 in 634c991
| public long seekSeconds(int seconds) throws StreamPlayerException { | |
| int durationInSeconds = this.getDurationInSeconds(); | |
| //Validate | |
| validateSeconds(seconds, durationInSeconds); | |
| //Calculate Bytes | |
| long totalBytes = getTotalBytes(); | |
| double percentage = (seconds * 100) / durationInSeconds; | |
| long bytes = (long) (totalBytes * (percentage / 100)); | |
| return seekBytes(this.getEncodedStreamPosition() + bytes); | |
| } |
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.
java-stream-player/src/main/java/com/goxr3plus/streamplayer/tools/TimeTool.java
Lines 117 to 120 in 634c991
| private static long durationInMilliseconds_Part2(final File file) { | |
| long milliseconds = -1; | |
| // exists? |
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