Skip to content

Commit b84945d

Browse files
committed
修复bug
1 parent 4b5d728 commit b84945d

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

dkplayer-java/src/main/java/com/dueeeke/videoplayer/player/VideoView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ protected boolean startPlay() {
214214
}
215215
initPlayer();
216216
startPrepare(false);
217+
addDisplay();
217218
return true;
218219
}
219220

@@ -449,6 +450,7 @@ public void replay(boolean resetPosition) {
449450
mCurrentPosition = 0;
450451
}
451452
startPrepare(true);
453+
addDisplay();
452454
}
453455

454456
/**
@@ -568,7 +570,6 @@ public void onInfo(int what, int extra) {
568570
@Override
569571
public void onPrepared() {
570572
setPlayState(STATE_PREPARED);
571-
addDisplay();
572573
if (mCurrentPosition > 0) {
573574
seekTo(mCurrentPosition);
574575
}

dkplayer-sample/src/main/java/com/dueeeke/dkplayer/adapter/Tiktok2Adapter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.widget.FrameLayout;
88
import android.widget.ImageView;
99
import android.widget.TextView;
10+
import android.widget.Toast;
1011

1112
import androidx.annotation.NonNull;
1213
import androidx.viewpager.widget.PagerAdapter;
@@ -72,6 +73,12 @@ public Object instantiateItem(@NonNull ViewGroup container, int position) {
7273
.placeholder(android.R.color.white)
7374
.into(viewHolder.mThumb);
7475
viewHolder.mTitle.setText(item.title);
76+
viewHolder.mTitle.setOnClickListener(new View.OnClickListener() {
77+
@Override
78+
public void onClick(View v) {
79+
Toast.makeText(context, "点击了标题", Toast.LENGTH_SHORT).show();
80+
}
81+
});
7582
viewHolder.mPosition = position;
7683
container.addView(view);
7784
return view;

dkplayer-ui/src/main/java/com/dueeeke/videocontroller/component/VodControlView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public VodControlView(@NonNull Context context, @Nullable AttributeSet attrs, in
7373
mPlayButton.setOnClickListener(this);
7474
mBottomProgress = findViewById(R.id.bottom_progress);
7575

76-
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
76+
//5.1以下系统SeekBar高度需要设置成WRAP_CONTENT
77+
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
7778
mVideoProgress.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
7879
}
7980
}

0 commit comments

Comments
 (0)