Skip to content
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

MediaPlayer seek #98

Open
erhuocqr opened this issue Mar 28, 2018 · 1 comment
Open

MediaPlayer seek #98

erhuocqr opened this issue Mar 28, 2018 · 1 comment

Comments

@erhuocqr
Copy link

public void seekTo(long usec) {
if(mCurrentState.ordinal() < State.PREPARED.ordinal() && mCurrentState.ordinal() >= State.RELEASING.ordinal()) {
mCurrentState = State.ERROR;
throw new IllegalStateException();
}
.......
}

i have a question about mCurrentState<3 && mCurrentState>5 ?why write like this? it seems never happen

@protyposis
Copy link
Owner

protyposis commented Mar 29, 2018

You cannot seek when no media source is loaded, which is when prepare has not been called and it is not in the PREPARED state, or after release has been called and the player is RELEASING or RELEASED, or when an error happened and it is in the ERROR state.

There's two possibilities, either ignore seek calls or throw an exception, which is what is happening here because the Android MediaPlayer does it as well and MediaPlayer-Extended is API compatible to the MediaPlayer so it needs to work similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants