-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on intiPlaylist and play next #23
Comments
I add 9 mp3 with this code |
@Spiderbezno You must interact with your loop decreasing -1 on size list. In another words, |
But if I do that My last element won't be present in the playlist will it?? |
NOw if i use result.size() -1 java.lang.IndexOutOfBoundsException: Index: 8, Size: 8 |
The behaviour strange. I use next button correctly for elements of the array to 0 for 3 but in the next it jump until the las elemnt?? |
and the results.size() -1 I think is not necessary because var i never enter in the loop when the value is 9 because nine is not < 9 |
You're right! public void nextAudio() throws AudioListNullPointerException {
if(playlist == null || playlist.size() == 0)
throw new AudioListNullPointerException();
else {
if (currentJcAudio != null) {
try {
JcAudio nextJcAudio = playlist.get(currentPositionList + position // 1);
this.currentJcAudio = nextJcAudio;
jcPlayerService.stop();
jcPlayerService.play(nextJcAudio);
} catch (IndexOutOfBoundsException e) {
playAudio(playlist.get(0)); // <-------- List on the end, then jump for the first audio
e.printStackTrace();
}
}
updatePositionAudioList();
playing = true;
paused = false;
}
}
public void previousAudio() throws AudioListNullPointerException {
if(playlist == null || playlist.size() == 0)
throw new AudioListNullPointerException();
else {
if (currentJcAudio != null) {
try {
JcAudio previousJcAudio = playlist.get(currentPositionList - position // 1);
this.currentJcAudio = previousJcAudio;
jcPlayerService.stop();
jcPlayerService.play(previousJcAudio);
} catch (IndexOutOfBoundsException e) {
playAudio(playlist.get(0)); // <-------- List is on the first audio, then keep here
e.printStackTrace();
}
}
updatePositionAudioList();
playing = true;
paused = false;
}
} |
This the behaviour always jump to first element, but I can next the first 2 elements before that always appear this error of IndexOutOfBoundsException |
I do more test if my playlist have more than six elements it produce errors, with six elements o less all ok |
are there some news?? |
Something new?? |
Is this library stopped? |
Are the library stopped? |
Any update? |
Sorry, I am not working properly on this library these months. This issue continues without a solution for now. |
W/System.err: java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
W/System.err: at java.util.ArrayList.get(ArrayList.java:411)
W/System.err: at com.example.jean.jcplayer.JcAudioPlayer.nextAudio(JcAudioPlayer.java:95)
W/System.err: at com.example.jean.jcplayer.JcPlayerView.next(JcPlayerView.java:161)
W/System.err: at com.example.jean.jcplayer.JcPlayerView.onClick(JcPlayerView.java:213)
W/System.err: at android.view.View.performClick(View.java:5637)
W/System.err: at android.view.View$PerformClick.run(View.java:22429)
W/System.err: at android.os.Handler.handleCallback(Handler.java:751)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err: at android.os.Looper.loop(Looper.java:154)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6119)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
The text was updated successfully, but these errors were encountered: