Skip to content

Commit

Permalink
add state check for all seek functions
Browse files Browse the repository at this point in the history
  • Loading branch information
autoandshare committed Mar 18, 2021
1 parent 4ed0d4f commit ba775a4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/autoandshare/headvr/lib/VideoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private float newPosition(float offset) {
private String seekController;

public void beginSeek(boolean forward, String seekController) {
if (state.seeking) {
if (!state.videoLoaded || state.seeking) {
return;
}
state.seeking = true;
Expand All @@ -86,6 +86,9 @@ public void beginSeek(boolean forward, String seekController) {
}

public void continueSeek(String seekController) {
if (!state.videoLoaded) {
return;
}
if ((!state.seeking) || (!seekController.equals(this.seekController))) {
return;
}
Expand All @@ -95,13 +98,19 @@ public void continueSeek(String seekController) {
}

public void cancelSeek(String seekController) {
if (!state.videoLoaded) {
return;
}
if (!seekController.equals(this.seekController)) {
return;
}
state.seeking = false;
}

public void singleSeek(float offset) {
if (!state.videoLoaded) {
return;
}
if (state.seeking) {
return;
}
Expand All @@ -110,6 +119,9 @@ public void singleSeek(float offset) {
}

public void confirmSeek(String seekController) {
if (!state.videoLoaded) {
return;
}
if (!state.seeking || (!seekController.equals(this.seekController))) {
return;
}
Expand Down

0 comments on commit ba775a4

Please sign in to comment.