Skip to content

Commit

Permalink
修改JZMediaExo中AGVideo的引用,减少耦合
Browse files Browse the repository at this point in the history
  • Loading branch information
ToxicR committed Sep 21, 2020
1 parent 9e301a3 commit 0794b1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 2 additions & 7 deletions demo/src/main/java/cn/jzvd/demo/CustomMedia/JZMediaExo.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

import cn.jzvd.JZMediaInterface;
import cn.jzvd.Jzvd;
import cn.jzvd.demo.Tab_2_Custom.AGVideo.AGVideo;
import cn.jzvd.demo.R;

/**
Expand Down Expand Up @@ -161,9 +160,7 @@ public void seekTo(long time) {
}
if (time != previousSeek) {
if (time >= simpleExoPlayer.getBufferedPosition()) {
if (jzvd instanceof AGVideo) {
((AGVideo) jzvd).showProgress();
}
jzvd.onStatePreparingPlaying();
}
simpleExoPlayer.seekTo(time);
previousSeek = time;
Expand Down Expand Up @@ -243,9 +240,7 @@ public void onPlayerStateChanged(final boolean playWhenReady, final int playback
}
break;
case Player.STATE_BUFFERING: {
if (jzvd instanceof AGVideo) {
((AGVideo) jzvd).showProgress();
}
jzvd.onStatePreparingPlaying();
handler.post(callback);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,12 @@ public void hideProgress() {
}
}

@Override
public void onStatePreparingPlaying() {
state = STATE_PREPARING_PLAYING;
showProgress();
}

public void showProgress() {
if (loadingView.getVisibility() != View.VISIBLE) {
loadingView.setVisibility(VISIBLE);
Expand Down

0 comments on commit 0794b1f

Please sign in to comment.